var googleMapPopUp = new function() {var gMapPopUp = this;this.init = function( settings ) {gMapPopUp.locationData = settings.locationData;gMapPopUp.mapsDisplayDomain = settings.mapsDisplayDomain;gMapPopUp.longFreeCustomer = settings.longFreeCustomer;gMapPopUp.language = settings.language;var location = gMapPopUp.locationData.data('location');gMapPopUp.locationData.on('click',function() {buildPopup('popupRestaurantReservations','','',gMapPopUp.mapsDisplayDomain + '/include/globalMapDisplay.php?cad=1&q='+encodeURIComponent(location)+'&fl=1&l='+encodeURIComponent(gMapPopUp.language)+'&ilfc='+encodeURIComponent(gMapPopUp.longFreeCustomer),true,false,true,'','');});};}; jQuery(function($) {AgendaModuleInitialize();});function AgendaModuleInitialize() {$( document ).on( "s123.page.ready", function( event ) {var $sections = $('.s123-module-agenda.layout-2');$sections.each(function( index ) {var $s = $(this);var $categories = $s.find('.filter a');$categories.off('click').on('click',function ( event, initialize ) {var $category = $(this);var $agenda = $s.find('.agenda-category');$s.find('.filter li').removeClass('active');$category.parent().addClass('active');var $filtered = $agenda.filter('[data-filter=' + $category.data('filter') + ']');if ( initialize ) {$agenda.hide();$filtered.show();} else {$agenda.fadeOut(200).promise().done( function() {$filtered.fadeIn(200);$(window).trigger('scroll');});} return false;});$categories.first().trigger('click',true);});});} jQuery(function($) {AgendaModuleInitialize_Layout3();});function AgendaModuleInitialize_Layout3() {$( document ).on( "s123.page.ready", function( event ) {var $sections = $('.s123-module-agenda.layout-3');$sections.each(function( index ) {var $s = $(this);var $categories = $s.find('.agenda-categories-container li');var $agenda = $s.find('.agenda-category');$categories.off('click').on('click',function ( event, initialize ) {var $category = $(this);$categories.removeClass('active');$category.addClass('active');var $filtered = $agenda.filter('[data-filter=' + $category.data('filter') + ']');if ( initialize ) {$agenda.hide();$filtered.show();} else {$agenda.fadeOut(200).promise().done( function() {$filtered.fadeIn(200);$(window).trigger('scroll');});} return false;});$categories.first().trigger('click',true);$s.find('.agenda-responsive-filter').off('click').on('click', function() {var $category = $(this);$s.find('.categories-panel').slideToggle('slow');$category.toggleClass('active');return false;});});});} (function(factory) {if (typeof define === "function" && define.amd) {define([ "jquery" ], function($) {factory($, window, document);});} else if (typeof module === "object" && module.exports) {module.exports = factory(require("jquery"), window, document);} else {factory(jQuery, window, document);}})(function($, window, document, undefined) {"use strict";var pluginName = "intlTelInput", id = 1, // give each instance it's own id for namespaced event handling defaults = {allowDropdown: true,autoHideDialCode: true,autoPlaceholder: true,customPlaceholder: null,dropdownContainer: "",excludeCountries: [],formatOnInit: true,geoIpLookup: null,initialCountry: "",nationalMode: true,numberType: "MOBILE",onlyCountries: [],preferredCountries: [ "us", "gb" ],separateDialCode: false,utilsScript: ""}, keys = {UP: 38,DOWN: 40,ENTER: 13,ESC: 27,PLUS: 43,A: 65,Z: 90,SPACE: 32,TAB: 9};$(window).load(function() {$.fn[pluginName].windowLoaded = true;});function Plugin(element, options) {this.telInput = $(element);this.options = $.extend({}, defaults, options);this.ns = "." + pluginName + id++;this.isGoodBrowser = Boolean(element.setSelectionRange);this.hadInitialPlaceholder = Boolean($(element).attr("placeholder"));} Plugin.prototype = {_init: function() {if (this.options.nationalMode) {this.options.autoHideDialCode = false;} if (this.options.separateDialCode) {this.options.autoHideDialCode = this.options.nationalMode = false;this.options.allowDropdown = true;} this.isMobile = /Android.+Mobile|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);if (this.isMobile) {$("body").addClass("iti-mobile");if (!this.options.dropdownContainer) {this.options.dropdownContainer = "body";}} this.autoCountryDeferred = new $.Deferred();this.utilsScriptDeferred = new $.Deferred();this._processCountryData();this._generateMarkup();this._setInitialState();this._initListeners();this._initRequests();return [ this.autoCountryDeferred, this.utilsScriptDeferred ];},_processCountryData: function() {this._processAllCountries();this._processCountryCodes();this._processPreferredCountries();},_addCountryCode: function(iso2, dialCode, priority) {if (!(dialCode in this.countryCodes)) {this.countryCodes[dialCode] = [];} var index = priority || 0;this.countryCodes[dialCode][index] = iso2;},_filterCountries: function(countryArray, processFunc) {var i;for (i = 0; i < countryArray.length; i++) {countryArray[i] = countryArray[i].toLowerCase();} this.countries = [];for (i = 0; i < allCountries.length; i++) {if (processFunc($.inArray(allCountries[i].iso2, countryArray))) {this.countries.push(allCountries[i]);}}},_processAllCountries: function() {if (this.options.onlyCountries.length) {this._filterCountries(this.options.onlyCountries, function(inArray) {return inArray != -1;});} else if (this.options.excludeCountries.length) {this._filterCountries(this.options.excludeCountries, function(inArray) {return inArray == -1;});} else {this.countries = allCountries;}},_processCountryCodes: function() {this.countryCodes = {};for (var i = 0; i < this.countries.length; i++) {var c = this.countries[i];this._addCountryCode(c.iso2, c.dialCode, c.priority);if (c.areaCodes) {for (var j = 0; j < c.areaCodes.length; j++) {this._addCountryCode(c.iso2, c.dialCode + c.areaCodes[j]);}}}},_processPreferredCountries: function() {this.preferredCountries = [];for (var i = 0; i < this.options.preferredCountries.length; i++) {var countryCode = this.options.preferredCountries[i].toLowerCase(), countryData = this._getCountryData(countryCode, false, true);if (countryData) {this.preferredCountries.push(countryData);}}},_generateMarkup: function() {this.telInput.attr("autocomplete", "off");var parentClass = "intl-tel-input";if (this.options.allowDropdown) {parentClass += " allow-dropdown";} if (this.options.separateDialCode) {parentClass += " separate-dial-code";} this.telInput.wrap($("
", {"class": parentClass}));this.flagsContainer = $("
", {"class": "flag-container"}).insertBefore(this.telInput);var selectedFlag = $("
", {"class": "selected-flag"});selectedFlag.appendTo(this.flagsContainer);this.selectedFlagInner = $("
", {"class": "iti-flag"}).appendTo(selectedFlag);if (this.options.separateDialCode) {this.selectedDialCode = $("
", {"class": "selected-dial-code"}).appendTo(selectedFlag);} if (this.options.allowDropdown) {selectedFlag.attr("tabindex", "0");$("
", {"class": "iti-arrow"}).appendTo(selectedFlag);this.countryList = $("
    ", {"class": "country-list hide"});if (this.preferredCountries.length) {this._appendListItems(this.preferredCountries, "preferred");$("
  • ", {"class": "divider"}).appendTo(this.countryList);} this._appendListItems(this.countries, "");this.countryListItems = this.countryList.children(".country");if (this.options.dropdownContainer) {this.dropdown = $("
    ", {"class": "intl-tel-input iti-container"}).append(this.countryList);} else {this.countryList.appendTo(this.flagsContainer);}} else {this.countryListItems = $();}},_appendListItems: function(countries, className) {var tmp = "";for (var i = 0; i < countries.length; i++) {var c = countries[i];tmp += "
  • ";tmp += "
    ";tmp += "" + c.name + "";tmp += "+" + c.dialCode + "";tmp += "
  • ";} this.countryList.append(tmp);},_setInitialState: function() {var val = this.telInput.val();if (this._getDialCode(val)) {this._updateFlagFromNumber(val, true);} else if (this.options.initialCountry !== "auto") {if (this.options.initialCountry) {this._setFlag(this.options.initialCountry, true);} else {this.defaultCountry = this.preferredCountries.length ? this.preferredCountries[0].iso2 : this.countries[0].iso2;if (!val) {this._setFlag(this.defaultCountry, true);}} if (!val && !this.options.nationalMode && !this.options.autoHideDialCode && !this.options.separateDialCode) {this.telInput.val("+" + this.selectedCountryData.dialCode);}} if (val) {this._updateValFromNumber(val, this.options.formatOnInit);}},_initListeners: function() {this._initKeyListeners();if (this.options.autoHideDialCode) {this._initFocusListeners();} if (this.options.allowDropdown) {this._initDropdownListeners();}},_initDropdownListeners: function() {var that = this;var label = this.telInput.closest("label");if (label.length) {label.on("click" + this.ns, function(e) {if (that.countryList.hasClass("hide")) {that.telInput.focus();} else {e.preventDefault();}});} var selectedFlag = this.selectedFlagInner.parent();selectedFlag.on("click" + this.ns, function(e) {if (that.countryList.hasClass("hide") && !that.telInput.prop("disabled") && !that.telInput.prop("readonly")) {that._showDropdown();}});this.flagsContainer.on("keydown" + that.ns, function(e) {var isDropdownHidden = that.countryList.hasClass("hide");if (isDropdownHidden && (e.which == keys.UP || e.which == keys.DOWN || e.which == keys.SPACE || e.which == keys.ENTER)) {e.preventDefault();e.stopPropagation();that._showDropdown();} if (e.which == keys.TAB) {that._closeDropdown();}});},_initRequests: function() {var that = this;if (this.options.utilsScript) {if ($.fn[pluginName].windowLoaded) {$.fn[pluginName].loadUtils(this.options.utilsScript, this.utilsScriptDeferred);} else {$(window).load(function() {$.fn[pluginName].loadUtils(that.options.utilsScript, that.utilsScriptDeferred);});}} else {this.utilsScriptDeferred.resolve();} if (this.options.initialCountry === "auto") {this._loadAutoCountry();} else {this.autoCountryDeferred.resolve();}},_loadAutoCountry: function() {var that = this;var cookieAutoCountry = window.Cookies ? Cookies.get("itiAutoCountry") : "";if (cookieAutoCountry) {$.fn[pluginName].autoCountry = cookieAutoCountry;} if ($.fn[pluginName].autoCountry) {this.handleAutoCountry();} else if (!$.fn[pluginName].startedLoadingAutoCountry) {$.fn[pluginName].startedLoadingAutoCountry = true;if (typeof this.options.geoIpLookup === "function") {this.options.geoIpLookup(function(countryCode) {$.fn[pluginName].autoCountry = countryCode.toLowerCase();if (window.Cookies) {Cookies.set("itiAutoCountry", $.fn[pluginName].autoCountry, {path: "/"});} setTimeout(function() {$(".intl-tel-input input").intlTelInput("handleAutoCountry");});});}}},_initKeyListeners: function() {var that = this;this.telInput.on("keyup" + this.ns, function() {that._updateFlagFromNumber(that.telInput.val());});this.telInput.on("cut" + this.ns + " paste" + this.ns + " keyup" + this.ns, function() {setTimeout(function() {that._updateFlagFromNumber(that.telInput.val());});});},_cap: function(number) {var max = this.telInput.attr("maxlength");return max && number.length > max ? number.substr(0, max) : number;},_initFocusListeners: function() {var that = this;this.telInput.on("mousedown" + this.ns, function(e) {if (!that.telInput.is(":focus") && !that.telInput.val()) {e.preventDefault();that.telInput.focus();}});this.telInput.on("focus" + this.ns, function(e) {if (!that.telInput.val() && !that.telInput.prop("readonly") && that.selectedCountryData.dialCode) {that.telInput.val("+" + that.selectedCountryData.dialCode);that.telInput.one("keypress.plus" + that.ns, function(e) {if (e.which == keys.PLUS) {that.telInput.val("");}});setTimeout(function() {var input = that.telInput[0];if (that.isGoodBrowser) {var len = that.telInput.val().length;input.setSelectionRange(len, len);}});}});var form = this.telInput.prop("form");if (form) {$(form).on("submit" + this.ns, function() {that._removeEmptyDialCode();});} this.telInput.on("blur" + this.ns, function() {that._removeEmptyDialCode();});},_removeEmptyDialCode: function() {var value = this.telInput.val(), startsPlus = value.charAt(0) == "+";if (startsPlus) {var numeric = this._getNumeric(value);if (!numeric || this.selectedCountryData.dialCode == numeric) {this.telInput.val("");}} this.telInput.off("keypress.plus" + this.ns);},_getNumeric: function(s) {return s.replace(/\D/g, "");},_showDropdown: function() {this._setDropdownPosition();var activeListItem = this.countryList.children(".active");if (activeListItem.length) {this._highlightListItem(activeListItem);this._scrollTo(activeListItem);} this._bindDropdownListeners();this.selectedFlagInner.children(".iti-arrow").addClass("up");},_setDropdownPosition: function() {var that = this;if (this.options.dropdownContainer) {this.dropdown.appendTo(this.options.dropdownContainer);} this.dropdownHeight = this.countryList.removeClass("hide").outerHeight();if (!this.isMobile) {var pos = this.telInput.offset(), inputTop = pos.top, windowTop = $(window).scrollTop(), // dropdownFitsBelow = (dropdownBottom < windowBottom) dropdownFitsBelow = inputTop + this.telInput.outerHeight() + this.dropdownHeight < windowTop + $(window).height(), dropdownFitsAbove = inputTop - this.dropdownHeight > windowTop;this.countryList.toggleClass("dropup", !dropdownFitsBelow && dropdownFitsAbove);if (this.options.dropdownContainer) {var extraTop = !dropdownFitsBelow && dropdownFitsAbove ? 0 : this.telInput.innerHeight();this.dropdown.css({top: inputTop + extraTop,left: pos.left});$(window).on("scroll" + this.ns, function() {that._closeDropdown();});}}},_bindDropdownListeners: function() {var that = this;this.countryList.on("mouseover" + this.ns, ".country", function(e) {that._highlightListItem($(this));});this.countryList.on("click" + this.ns, ".country", function(e) {that._selectListItem($(this));});var isOpening = true;$("html").on("click" + this.ns, function(e) {if (!isOpening) {that._closeDropdown();} isOpening = false;});var query = "", queryTimer = null;$(document).on("keydown" + this.ns, function(e) {e.preventDefault();if (e.which == keys.UP || e.which == keys.DOWN) {that._handleUpDownKey(e.which);} else if (e.which == keys.ENTER) {that._handleEnterKey();} else if (e.which == keys.ESC) {that._closeDropdown();} else if (e.which >= keys.A && e.which <= keys.Z || e.which == keys.SPACE) {if (queryTimer) {clearTimeout(queryTimer);} query += String.fromCharCode(e.which);that._searchForCountry(query);queryTimer = setTimeout(function() {query = "";}, 1e3);}});},_handleUpDownKey: function(key) {var current = this.countryList.children(".highlight").first();var next = key == keys.UP ? current.prev() : current.next();if (next.length) {if (next.hasClass("divider")) {next = key == keys.UP ? next.prev() : next.next();} this._highlightListItem(next);this._scrollTo(next);}},_handleEnterKey: function() {var currentCountry = this.countryList.children(".highlight").first();if (currentCountry.length) {this._selectListItem(currentCountry);}},_searchForCountry: function(query) {for (var i = 0; i < this.countries.length; i++) {if (this._startsWith(this.countries[i].name, query)) {var listItem = this.countryList.children("[data-country-code=" + this.countries[i].iso2 + "]").not(".preferred");this._highlightListItem(listItem);this._scrollTo(listItem, true);break;}}},_startsWith: function(a, b) {return a.substr(0, b.length).toUpperCase() == b;},_updateValFromNumber: function(number, doFormat, format) {if (doFormat && window.intlTelInputUtils && this.selectedCountryData) {if (!$.isNumeric(format)) {format = !this.options.separateDialCode && (this.options.nationalMode || number.charAt(0) != "+") ? intlTelInputUtils.numberFormat.NATIONAL : intlTelInputUtils.numberFormat.INTERNATIONAL;} number = intlTelInputUtils.formatNumber(number, this.selectedCountryData.iso2, format);} number = this._beforeSetNumber(number);this.telInput.val(number);},_updateFlagFromNumber: function(number, isInit) {if (number && this.options.nationalMode && this.selectedCountryData && this.selectedCountryData.dialCode == "1" && number.charAt(0) != "+") {if (number.charAt(0) != "1") {number = "1" + number;} number = "+" + number;} var dialCode = this._getDialCode(number), countryCode = null;if (dialCode) {var countryCodes = this.countryCodes[this._getNumeric(dialCode)], alreadySelected = this.selectedCountryData && $.inArray(this.selectedCountryData.iso2, countryCodes) != -1;if (!alreadySelected || this._isUnknownNanp(number, dialCode)) {for (var j = 0; j < countryCodes.length; j++) {if (countryCodes[j]) {countryCode = countryCodes[j];break;}}}} else if (number.charAt(0) == "+" && this._getNumeric(number).length) {countryCode = "";} else if (!number || number == "+") {countryCode = this.defaultCountry;} if (countryCode !== null) {this._setFlag(countryCode, isInit);}},_isUnknownNanp: function(number, dialCode) {return dialCode == "+1" && this._getNumeric(number).length >= 4;},_highlightListItem: function(listItem) {this.countryListItems.removeClass("highlight");listItem.addClass("highlight");},_getCountryData: function(countryCode, ignoreOnlyCountriesOption, allowFail) {var countryList = ignoreOnlyCountriesOption ? allCountries : this.countries;for (var i = 0; i < countryList.length; i++) {if (countryList[i].iso2 == countryCode) {return countryList[i];}} if (allowFail) {return null;} else {throw new Error("No country data for '" + countryCode + "'");}},_setFlag: function(countryCode, isInit) {var prevCountry = this.selectedCountryData && this.selectedCountryData.iso2 ? this.selectedCountryData : {};this.selectedCountryData = countryCode ? this._getCountryData(countryCode, false, false) : {};if (this.selectedCountryData.iso2) {this.defaultCountry = this.selectedCountryData.iso2;} this.selectedFlagInner.attr("class", "iti-flag " + countryCode);var title = countryCode ? this.selectedCountryData.name + ": +" + this.selectedCountryData.dialCode : "Unknown";this.selectedFlagInner.parent().attr("title", title);if (this.options.separateDialCode) {var dialCode = this.selectedCountryData.dialCode ? "+" + this.selectedCountryData.dialCode : "", parent = this.telInput.parent();if (prevCountry.dialCode) {parent.removeClass("iti-sdc-" + (prevCountry.dialCode.length + 1));} if (dialCode) {parent.addClass("iti-sdc-" + dialCode.length);} this.selectedDialCode.text(dialCode);} this._updatePlaceholder();this.countryListItems.removeClass("active");if (countryCode) {this.countryListItems.find(".iti-flag." + countryCode).first().closest(".country").addClass("active");} if (!isInit && prevCountry.iso2 !== countryCode) {this.telInput.trigger("countrychange", this.selectedCountryData);}},_updatePlaceholder: function() {if (window.intlTelInputUtils && !this.hadInitialPlaceholder && this.options.autoPlaceholder && this.selectedCountryData) {var numberType = intlTelInputUtils.numberType[this.options.numberType], placeholder = this.selectedCountryData.iso2 ? intlTelInputUtils.getExampleNumber(this.selectedCountryData.iso2, this.options.nationalMode, numberType) : "";placeholder = this._beforeSetNumber(placeholder);if (typeof this.options.customPlaceholder === "function") {placeholder = this.options.customPlaceholder(placeholder, this.selectedCountryData);} this.telInput.attr("placeholder", placeholder);}},_selectListItem: function(listItem) {this._setFlag(listItem.attr("data-country-code"));this._closeDropdown();this._updateDialCode(listItem.attr("data-dial-code"), true);this.telInput.focus();if (this.isGoodBrowser) {var len = this.telInput.val().length;this.telInput[0].setSelectionRange(len, len);}},_closeDropdown: function() {this.countryList.addClass("hide");this.selectedFlagInner.children(".iti-arrow").removeClass("up");$(document).off(this.ns);$("html").off(this.ns);this.countryList.off(this.ns);if (this.options.dropdownContainer) {if (!this.isMobile) {$(window).off("scroll" + this.ns);} this.dropdown.detach();}},_scrollTo: function(element, middle) {var container = this.countryList, containerHeight = container.height(), containerTop = container.offset().top, containerBottom = containerTop + containerHeight, elementHeight = element.outerHeight(), elementTop = element.offset().top, elementBottom = elementTop + elementHeight, newScrollTop = elementTop - containerTop + container.scrollTop(), middleOffset = containerHeight / 2 - elementHeight / 2;if (elementTop < containerTop) {if (middle) {newScrollTop -= middleOffset;} container.scrollTop(newScrollTop);} else if (elementBottom > containerBottom) {if (middle) {newScrollTop += middleOffset;} var heightDifference = containerHeight - elementHeight;container.scrollTop(newScrollTop - heightDifference);}},_updateDialCode: function(newDialCode, hasSelectedListItem) {var inputVal = this.telInput.val(), newNumber;newDialCode = "+" + newDialCode;if (inputVal.charAt(0) == "+") {var prevDialCode = this._getDialCode(inputVal);if (prevDialCode) {newNumber = inputVal.replace(prevDialCode, newDialCode);} else {newNumber = newDialCode;}} else if (this.options.nationalMode || this.options.separateDialCode) {return;} else {if (inputVal) {newNumber = newDialCode + inputVal;} else if (hasSelectedListItem || !this.options.autoHideDialCode) {newNumber = newDialCode;} else {return;}} this.telInput.val(newNumber);},_getDialCode: function(number) {var dialCode = "";if (number.charAt(0) == "+") {var numericChars = "";for (var i = 0; i < number.length; i++) {var c = number.charAt(i);if ($.isNumeric(c)) {numericChars += c;if (this.countryCodes[numericChars]) {dialCode = number.substr(0, i + 1);} if (numericChars.length == 4) {break;}}}} return dialCode;},_getFullNumber: function() {var prefix = this.options.separateDialCode ? "+" + this.selectedCountryData.dialCode : "";return prefix + this.telInput.val();},_beforeSetNumber: function(number) {if (this.options.separateDialCode) {var dialCode = this._getDialCode(number);if (dialCode) {if (this.selectedCountryData.areaCodes !== null) {dialCode = "+" + this.selectedCountryData.dialCode;} var start = number[dialCode.length] === " " || number[dialCode.length] === "-" ? dialCode.length + 1 : dialCode.length;number = number.substr(start);}} return this._cap(number);},handleAutoCountry: function() {if (this.options.initialCountry === "auto") {this.defaultCountry = $.fn[pluginName].autoCountry;if (!this.telInput.val()) {this.setCountry(this.defaultCountry);} this.autoCountryDeferred.resolve();}},destroy: function() {if (this.allowDropdown) {this._closeDropdown();this.selectedFlagInner.parent().off(this.ns);this.telInput.closest("label").off(this.ns);} if (this.options.autoHideDialCode) {var form = this.telInput.prop("form");if (form) {$(form).off(this.ns);}} this.telInput.off(this.ns);var container = this.telInput.parent();container.before(this.telInput).remove();},getExtension: function() {if (window.intlTelInputUtils) {return intlTelInputUtils.getExtension(this._getFullNumber(), this.selectedCountryData.iso2);} return "";},getNumber: function(format) {if (window.intlTelInputUtils) {return intlTelInputUtils.formatNumber(this._getFullNumber(), this.selectedCountryData.iso2, format);} return "";},getNumberType: function() {if (window.intlTelInputUtils) {return intlTelInputUtils.getNumberType(this._getFullNumber(), this.selectedCountryData.iso2);} return -99;},getSelectedCountryData: function() {return this.selectedCountryData || {};},getValidationError: function() {if (window.intlTelInputUtils) {return intlTelInputUtils.getValidationError(this._getFullNumber(), this.selectedCountryData.iso2);} return -99;},isValidNumber: function() {var val = $.trim(this._getFullNumber()), countryCode = this.options.nationalMode ? this.selectedCountryData.iso2 : "";return window.intlTelInputUtils ? intlTelInputUtils.isValidNumber(val, countryCode) : null;},setCountry: function(countryCode) {countryCode = countryCode.toLowerCase();if (!this.selectedFlagInner.hasClass(countryCode)) {this._setFlag(countryCode);this._updateDialCode(this.selectedCountryData.dialCode, false);}},setNumber: function(number, format) {this._updateFlagFromNumber(number);this._updateValFromNumber(number, $.isNumeric(format), format);},handleUtils: function() {if (window.intlTelInputUtils) {if (this.telInput.val()) {this._updateValFromNumber(this.telInput.val(), this.options.formatOnInit);} this._updatePlaceholder();} this.utilsScriptDeferred.resolve();}};$.fn[pluginName] = function(options) {var args = arguments;if (options === undefined || typeof options === "object") {var deferreds = [];this.each(function() {if (!$.data(this, "plugin_" + pluginName)) {var instance = new Plugin(this, options);var instanceDeferreds = instance._init();deferreds.push(instanceDeferreds[0]);deferreds.push(instanceDeferreds[1]);$.data(this, "plugin_" + pluginName, instance);}});return $.when.apply(null, deferreds);} else if (typeof options === "string" && options[0] !== "_") {var returns;this.each(function() {var instance = $.data(this, "plugin_" + pluginName);if (instance instanceof Plugin && typeof instance[options] === "function") {returns = instance[options].apply(instance, Array.prototype.slice.call(args, 1));} if (options === "destroy") {$.data(this, "plugin_" + pluginName, null);}});return returns !== undefined ? returns : this;}};$.fn[pluginName].getCountryData = function() {return allCountries;};$.fn[pluginName].loadUtils = function(path, utilsScriptDeferred) {if (!$.fn[pluginName].loadedUtilsScript) {$.fn[pluginName].loadedUtilsScript = true;$.ajax({url: path,complete: function() {$(".intl-tel-input input").intlTelInput("handleUtils");},dataType: "script",cache: true});} else if (utilsScriptDeferred) {utilsScriptDeferred.resolve();}};$.fn[pluginName].version = "8.5.2";var allCountries = [ [ "Afghanistan (‫افغانستان‬‎)", "af", "93" ], [ "Albania (Shqipëri)", "al", "355" ], [ "Algeria (‫الجزائر‬‎)", "dz", "213" ], [ "American Samoa", "as", "1684" ], [ "Andorra", "ad", "376" ], [ "Angola", "ao", "244" ], [ "Anguilla", "ai", "1264" ], [ "Antigua and Barbuda", "ag", "1268" ], [ "Argentina", "ar", "54" ], [ "Armenia (Հայաստան)", "am", "374" ], [ "Aruba", "aw", "297" ], [ "Australia", "au", "61", 0 ], [ "Austria (Österreich)", "at", "43" ], [ "Azerbaijan (Azərbaycan)", "az", "994" ], [ "Bahamas", "bs", "1242" ], [ "Bahrain (‫البحرين‬‎)", "bh", "973" ], [ "Bangladesh (বাংলাদেশ)", "bd", "880" ], [ "Barbados", "bb", "1246" ], [ "Belarus (Беларусь)", "by", "375" ], [ "Belgium (België)", "be", "32" ], [ "Belize", "bz", "501" ], [ "Benin (Bénin)", "bj", "229" ], [ "Bermuda", "bm", "1441" ], [ "Bhutan (འབྲུག)", "bt", "975" ], [ "Bolivia", "bo", "591" ], [ "Bosnia and Herzegovina (Босна и Херцеговина)", "ba", "387" ], [ "Botswana", "bw", "267" ], [ "Brazil (Brasil)", "br", "55" ], [ "British Indian Ocean Territory", "io", "246" ], [ "British Virgin Islands", "vg", "1284" ], [ "Brunei", "bn", "673" ], [ "Bulgaria (България)", "bg", "359" ], [ "Burkina Faso", "bf", "226" ], [ "Burundi (Uburundi)", "bi", "257" ], [ "Cambodia (កម្ពុជា)", "kh", "855" ], [ "Cameroon (Cameroun)", "cm", "237" ], [ "Canada", "ca", "1", 1, [ "204", "226", "236", "249", "250", "289", "306", "343", "365", "387", "403", "416", "418", "431", "437", "438", "450", "506", "514", "519", "548", "579", "581", "587", "604", "613", "639", "647", "672", "705", "709", "742", "778", "780", "782", "807", "819", "825", "867", "873", "902", "905" ] ], [ "Cape Verde (Kabu Verdi)", "cv", "238" ], [ "Caribbean Netherlands", "bq", "599", 1 ], [ "Cayman Islands", "ky", "1345" ], [ "Central African Republic (République centrafricaine)", "cf", "236" ], [ "Chad (Tchad)", "td", "235" ], [ "Chile", "cl", "56" ], [ "China (中国)", "cn", "86" ], [ "Christmas Island", "cx", "61", 2 ], [ "Cocos (Keeling) Islands", "cc", "61", 1 ], [ "Colombia", "co", "57" ], [ "Comoros (‫جزر القمر‬‎)", "km", "269" ], [ "Congo (DRC) (Jamhuri ya Kidemokrasia ya Kongo)", "cd", "243" ], [ "Congo (Republic) (Congo-Brazzaville)", "cg", "242" ], [ "Cook Islands", "ck", "682" ], [ "Costa Rica", "cr", "506" ], [ "Côte d’Ivoire", "ci", "225" ], [ "Croatia (Hrvatska)", "hr", "385" ], [ "Cuba", "cu", "53" ], [ "Curaçao", "cw", "599", 0 ], [ "Cyprus (Κύπρος)", "cy", "357" ], [ "Czech Republic (Česká republika)", "cz", "420" ], [ "Denmark (Danmark)", "dk", "45" ], [ "Djibouti", "dj", "253" ], [ "Dominica", "dm", "1767" ], [ "Dominican Republic (República Dominicana)", "do", "1", 2, [ "809", "829", "849" ] ], [ "Ecuador", "ec", "593" ], [ "Egypt (‫مصر‬‎)", "eg", "20" ], [ "El Salvador", "sv", "503" ], [ "Equatorial Guinea (Guinea Ecuatorial)", "gq", "240" ], [ "Eritrea", "er", "291" ], [ "Estonia (Eesti)", "ee", "372" ], [ "Ethiopia", "et", "251" ], [ "Falkland Islands (Islas Malvinas)", "fk", "500" ], [ "Faroe Islands (Føroyar)", "fo", "298" ], [ "Fiji", "fj", "679" ], [ "Finland (Suomi)", "fi", "358", 0 ], [ "France", "fr", "33" ], [ "French Guiana (Guyane française)", "gf", "594" ], [ "French Polynesia (Polynésie française)", "pf", "689" ], [ "Gabon", "ga", "241" ], [ "Gambia", "gm", "220" ], [ "Georgia (საქართველო)", "ge", "995" ], [ "Germany (Deutschland)", "de", "49" ], [ "Ghana (Gaana)", "gh", "233" ], [ "Gibraltar", "gi", "350" ], [ "Greece (Ελλάδα)", "gr", "30" ], [ "Greenland (Kalaallit Nunaat)", "gl", "299" ], [ "Grenada", "gd", "1473" ], [ "Guadeloupe", "gp", "590", 0 ], [ "Guam", "gu", "1671" ], [ "Guatemala", "gt", "502" ], [ "Guernsey", "gg", "44", 1 ], [ "Guinea (Guinée)", "gn", "224" ], [ "Guinea-Bissau (Guiné Bissau)", "gw", "245" ], [ "Guyana", "gy", "592" ], [ "Haiti", "ht", "509" ], [ "Honduras", "hn", "504" ], [ "Hong Kong (香港)", "hk", "852" ], [ "Hungary (Magyarország)", "hu", "36" ], [ "Iceland (Ísland)", "is", "354" ], [ "India (भारत)", "in", "91" ], [ "Indonesia", "id", "62" ], [ "Iran (‫ایران‬‎)", "ir", "98" ], [ "Iraq (‫العراق‬‎)", "iq", "964" ], [ "Ireland", "ie", "353" ], [ "Isle of Man", "im", "44", 2 ], [ "Israel (‫ישראל‬‎)", "il", "972" ], [ "Italy (Italia)", "it", "39", 0 ], [ "Jamaica", "jm", "1876" ], [ "Japan (日本)", "jp", "81" ], [ "Jersey", "je", "44", 3 ], [ "Jordan (‫الأردن‬‎)", "jo", "962" ], [ "Kazakhstan (Казахстан)", "kz", "7", 1 ], [ "Kenya", "ke", "254" ], [ "Kiribati", "ki", "686" ], [ "Kuwait (‫الكويت‬‎)", "kw", "965" ], [ "Kyrgyzstan (Кыргызстан)", "kg", "996" ], [ "Laos (ລາວ)", "la", "856" ], [ "Latvia (Latvija)", "lv", "371" ], [ "Lebanon (‫لبنان‬‎)", "lb", "961" ], [ "Lesotho", "ls", "266" ], [ "Liberia", "lr", "231" ], [ "Libya (‫ليبيا‬‎)", "ly", "218" ], [ "Liechtenstein", "li", "423" ], [ "Lithuania (Lietuva)", "lt", "370" ], [ "Luxembourg", "lu", "352" ], [ "Macau (澳門)", "mo", "853" ], [ "Macedonia (FYROM) (Македонија)", "mk", "389" ], [ "Madagascar (Madagasikara)", "mg", "261" ], [ "Malawi", "mw", "265" ], [ "Malaysia", "my", "60" ], [ "Maldives", "mv", "960" ], [ "Mali", "ml", "223" ], [ "Malta", "mt", "356" ], [ "Marshall Islands", "mh", "692" ], [ "Martinique", "mq", "596" ], [ "Mauritania (‫موريتانيا‬‎)", "mr", "222" ], [ "Mauritius (Moris)", "mu", "230" ], [ "Mayotte", "yt", "262", 1 ], [ "Mexico (México)", "mx", "52" ], [ "Micronesia", "fm", "691" ], [ "Moldova (Republica Moldova)", "md", "373" ], [ "Monaco", "mc", "377" ], [ "Mongolia (Монгол)", "mn", "976" ], [ "Montenegro (Crna Gora)", "me", "382" ], [ "Montserrat", "ms", "1664" ], [ "Morocco (‫المغرب‬‎)", "ma", "212", 0 ], [ "Mozambique (Moçambique)", "mz", "258" ], [ "Myanmar (Burma) (မြန်မာ)", "mm", "95" ], [ "Namibia (Namibië)", "na", "264" ], [ "Nauru", "nr", "674" ], [ "Nepal (नेपाल)", "np", "977" ], [ "Netherlands (Nederland)", "nl", "31" ], [ "New Caledonia (Nouvelle-Calédonie)", "nc", "687" ], [ "New Zealand", "nz", "64" ], [ "Nicaragua", "ni", "505" ], [ "Niger (Nijar)", "ne", "227" ], [ "Nigeria", "ng", "234" ], [ "Niue", "nu", "683" ], [ "Norfolk Island", "nf", "672" ], [ "North Korea (조선 민주주의 인민 공화국)", "kp", "850" ], [ "Northern Mariana Islands", "mp", "1670" ], [ "Norway (Norge)", "no", "47", 0 ], [ "Oman (‫عُمان‬‎)", "om", "968" ], [ "Pakistan (‫پاکستان‬‎)", "pk", "92" ], [ "Palau", "pw", "680" ], [ "Palestine (‫فلسطين‬‎)", "ps", "970" ], [ "Panama (Panamá)", "pa", "507" ], [ "Papua New Guinea", "pg", "675" ], [ "Paraguay", "py", "595" ], [ "Peru (Perú)", "pe", "51" ], [ "Philippines", "ph", "63" ], [ "Poland (Polska)", "pl", "48" ], [ "Portugal", "pt", "351" ], [ "Puerto Rico", "pr", "1", 3, [ "787", "939" ] ], [ "Qatar (‫قطر‬‎)", "qa", "974" ], [ "Réunion (La Réunion)", "re", "262", 0 ], [ "Romania (România)", "ro", "40" ], [ "Russia (Россия)", "ru", "7", 0 ], [ "Rwanda", "rw", "250" ], [ "Saint Barthélemy (Saint-Barthélemy)", "bl", "590", 1 ], [ "Saint Helena", "sh", "290" ], [ "Saint Kitts and Nevis", "kn", "1869" ], [ "Saint Lucia", "lc", "1758" ], [ "Saint Martin (Saint-Martin (partie française))", "mf", "590", 2 ], [ "Saint Pierre and Miquelon (Saint-Pierre-et-Miquelon)", "pm", "508" ], [ "Saint Vincent and the Grenadines", "vc", "1784" ], [ "Samoa", "ws", "685" ], [ "San Marino", "sm", "378" ], [ "São Tomé and Príncipe (São Tomé e Príncipe)", "st", "239" ], [ "Saudi Arabia (‫المملكة العربية السعودية‬‎)", "sa", "966" ], [ "Senegal (Sénégal)", "sn", "221" ], [ "Serbia (Србија)", "rs", "381" ], [ "Seychelles", "sc", "248" ], [ "Sierra Leone", "sl", "232" ], [ "Singapore", "sg", "65" ], [ "Sint Maarten", "sx", "1721" ], [ "Slovakia (Slovensko)", "sk", "421" ], [ "Slovenia (Slovenija)", "si", "386" ], [ "Solomon Islands", "sb", "677" ], [ "Somalia (Soomaaliya)", "so", "252" ], [ "South Africa", "za", "27" ], [ "South Korea (대한민국)", "kr", "82" ], [ "South Sudan (‫جنوب السودان‬‎)", "ss", "211" ], [ "Spain (España)", "es", "34" ], [ "Sri Lanka (ශ්‍රී ලංකාව)", "lk", "94" ], [ "Sudan (‫السودان‬‎)", "sd", "249" ], [ "Suriname", "sr", "597" ], [ "Svalbard and Jan Mayen", "sj", "47", 1 ], [ "Swaziland", "sz", "268" ], [ "Sweden (Sverige)", "se", "46" ], [ "Switzerland (Schweiz)", "ch", "41" ], [ "Syria (‫سوريا‬‎)", "sy", "963" ], [ "Taiwan (台灣)", "tw", "886" ], [ "Tajikistan", "tj", "992" ], [ "Tanzania", "tz", "255" ], [ "Thailand (ไทย)", "th", "66" ], [ "Timor-Leste", "tl", "670" ], [ "Togo", "tg", "228" ], [ "Tokelau", "tk", "690" ], [ "Tonga", "to", "676" ], [ "Trinidad and Tobago", "tt", "1868" ], [ "Tunisia (‫تونس‬‎)", "tn", "216" ], [ "Turkey (Türkiye)", "tr", "90" ], [ "Turkmenistan", "tm", "993" ], [ "Turks and Caicos Islands", "tc", "1649" ], [ "Tuvalu", "tv", "688" ], [ "U.S. Virgin Islands", "vi", "1340" ], [ "Uganda", "ug", "256" ], [ "Ukraine (Україна)", "ua", "380" ], [ "United Arab Emirates (‫الإمارات العربية المتحدة‬‎)", "ae", "971" ], [ "United Kingdom", "gb", "44", 0 ], [ "United States", "us", "1", 0 ], [ "Uruguay", "uy", "598" ], [ "Uzbekistan (Oʻzbekiston)", "uz", "998" ], [ "Vanuatu", "vu", "678" ], [ "Vatican City (Città del Vaticano)", "va", "39", 1 ], [ "Venezuela", "ve", "58" ], [ "Vietnam (Việt Nam)", "vn", "84" ], [ "Wallis and Futuna", "wf", "681" ], [ "Western Sahara (‫الصحراء الغربية‬‎)", "eh", "212", 1 ], [ "Yemen (‫اليمن‬‎)", "ye", "967" ], [ "Zambia", "zm", "260" ], [ "Zimbabwe", "zw", "263" ], [ "Åland Islands", "ax", "358", 1 ] ];for (var i = 0; i < allCountries.length; i++) {var c = allCountries[i];allCountries[i] = {name: c[0],iso2: c[1],dialCode: c[2],priority: c[3] || 0,areaCodes: c[4] || null};}}); !function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.Clipboard=t()}}(function(){var t,e,n;return function t(e,n,o){function i(c,a){if(!n[c]){if(!e[c]){var s="function"==typeof require&&require;if(!a&&s)return s(c,!0);if(r)return r(c,!0);var l=new Error("Cannot find module '"+c+"'");throw l.code="MODULE_NOT_FOUND",l}var u=n[c]={exports:{}};e[c][0].call(u.exports,function(t){var n=e[c][1][t];return i(n?n:t)},u,u.exports,t,e,n,o)}return n[c].exports}for(var r="function"==typeof require&&require,c=0;co;o++)n[o].fn.apply(n[o].ctx,e);return this},off:function(t,e){var n=this.e||(this.e={}),o=n[t],i=[];if(o&&e)for(var r=0,c=o.length;c>r;r++)o[r].fn!==e&&o[r].fn._!==e&&i.push(o[r]);return i.length?n[t]=i:delete n[t],this}},e.exports=o},{}],8:[function(e,n,o){!function(i,r){if("function"==typeof t&&t.amd)t(["module","select"],r);else if("undefined"!=typeof o)r(n,e("select"));else{var c={exports:{}};r(c,i.select),i.clipboardAction=c.exports}}(this,function(t,e){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=n(e),r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t},c=function(){function t(t,e){for(var n=0;n 1 && !$.isFunction(value)) {options = $.extend({}, config.defaults, options);if (typeof options.expires === 'number') {var days = options.expires, t = options.expires = new Date();t.setMilliseconds(t.getMilliseconds() + days * 864e+5);} return (document.cookie = [encode(key), '=', stringifyCookieValue(value),options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE options.path ? '; path=' + options.path : '',options.domain ? '; domain=' + options.domain : '',options.secure ? '; secure' : ''].join(''));} var result = key ? undefined : {},cookies = document.cookie ? document.cookie.split('; ') : [],i = 0,l = cookies.length;for (; i < l; i++) {var parts = cookies[i].split('='),name = decode(parts.shift()),cookie = parts.join('=');if (key === name) {result = read(cookie, value);break;} if (!key && (cookie = read(cookie)) !== undefined) {result[name] = cookie;}} return result;};config.defaults = {};$.removeCookie = function (key, options) {$.cookie(key, '', $.extend({}, options, { expires: -1 }));return !$.cookie(key);};})); !function(i){"use strict";"function"==typeof define&&define.amd?define(["jquery"],i):"undefined"!=typeof exports?module.exports=i(require("jquery")):i(jQuery)}(function(i){"use strict";var e=window.Slick||{};(e=function(){var e=0;return function(t,o){var s,n=this;n.defaults={accessibility:!0,adaptiveHeight:!1,appendArrows:i(t),appendDots:i(t),arrows:!0,asNavFor:null,prevArrow:'',nextArrow:'',autoplay:!1,autoplaySpeed:3e3,centerMode:!1,centerPadding:"50px",cssEase:"ease",customPaging:function(e,t){return i('`;});$container.html(newButtonsHtml);if ( $container.find('.quick-day-btn').length > 0 ) {$container.show();} $container.find('.quick-day-btn').on('click', function() {const selectedDate = $(this).data('date');const formattedDate = dayjs(selectedDate).format(that.calendarSettings.format);that.$hiddenInput.val(formattedDate);that.$fakeInput.html('
    ' + formattedDate + '
    (' + that.getDateDayName(selectedDate) + ')
    ');$container.find('.quick-day-btn').removeClass('active');$(this).addClass('active');hoursInputOriginalSettings.hoursInputSettings.onHoursLoad = function(chWidget, $tableHour) {if ( that.originalOnHoursLoad ) that.originalOnHoursLoad.call(this,that,that.HoursInput.$tableHour);} that.HoursInput.init({...hoursInputOriginalSettings,isQuickDaysValidator: false});that.HoursInput.$input.val(formattedDate);that.HoursInput.$input.trigger('change');});document.documentElement.style.setProperty('--quick-days-count', $container.find('.quick-day-btn').length);let selectedDay = null;if ( originalDate && originalDate.trim() !== '' ) {const originalFormattedDate = that.getDateAsIso(originalDate);daysToShow.forEach(day => {if ( day.date === dayjs(originalFormattedDate).format('YYYY-MM-DD') ) {selectedDay = day;}});} if ( !selectedDay && daysToShow.length > 0 ) {selectedDay = daysToShow[0];} if ( !selectedDateInCalendarByUser && selectedDay || selectedDateInCalendarByUser == selectedDay.date ) {$container.find(`.quick-day-btn[data-date="${selectedDay.date}"]`).addClass('active');const formattedDate = dayjs(selectedDay.date).format(that.calendarSettings.format);that.$hiddenInput.val(formattedDate);that.$fakeInput.html('
    ' + formattedDate + '
    (' + that.getDateDayName(selectedDay.date) + ')
    ');that.HoursInput.init({...hoursInputOriginalSettings,isQuickDaysValidator: false});}}} that.setDate = function( date ) {var dayObj = dayjs(date);dateTXT = dayObj.format(that.calendarSettings.format);that.$fakeInput.html('
    ' + dateTXT + '
    (' + that.getDateDayName(date) + ')
    ');that.$hiddenInput.val(dateTXT);};that.addPluginAbilityToInput = function() {that.$fakeInput.addClass('s123-calendar-handler-widget-input');that.$fakeInput.off('click').on('click', function() {that.showPopUp();});that.$fakeInputIcon.off('click').on('click', function() {that.showPopUp();});};that.showPopUp = function() {if ( that.isShown ) return;var $message = that.getMessageBody();that.$calendar = that.getCalendar();$message.find('.date-picker-container').append(that.$calendar);var $modal = that.calendarModalParent.bootbox.dialog({title: that.title,message: $message,className: `s123-calendar-handler-widget ${that.customClass}`,size: 'medium',closeButton: true,backdrop: true,show: false,onEscape: function() {},callback: function () {}}) .on('show.bs.modal', function() {that.loadDateAndTimeFromInput();that.isShown = true;}) .on('hide.bs.modal', function() {that.isShown = false;if ( that.HoursInput.$tableHour.data('tomselect') ) {that.HoursInput.$tableHour.data('tomselect').destroy();new UiRichSelect();}});$modal.find('.modal-header').addClass('background-primary-color btn-primary-text-color');$modal.find('.modal-header .bootbox-close-button').addClass('btn-primary-text-color');if ( that.isAdmin ) {$modal.find('.modal-header .bootbox-close-button').click(function() {$modal.modal('hide');});} that.datePickerSubmit(that.$calendar,$modal);$modal.modal('show');};that.loadDateAndTimeFromInput = function() {if ( that.$hiddenInput.val().length === 0 ) return;that.$calendar.attr('navigate-view-only','true');that.$calendar.datepicker('setDates',new Date(that.getDateAsIso(that.$hiddenInput.val())));};that.getCalendar = function() {var $calendar = $('
    ');$.fn.datepicker.dates[that.calendarSettings.language] = that.getCalendarTranslations();if ( that.calendarSettings.language == 'he' || that.calendarSettings.language == 'ar' ) {$.fn.datepicker.dates[that.calendarSettings.language].rtl = true;} var disabledDays = [];if ( !['fullTime','bySchedule'].includes(that.calendarSettings.availability) ) {$.each(that.calendarSettings.businessHours, function( index ) {if ( !that.calendarSettings.businessHours[index].isActive ) {disabledDays.push(index);}});} that.calendarSettings.daysOfWeekDisabled = disabledDays.join(',');if ( that.calendarSettings.availability == 'bySchedule' ) {$calendar.on('show changeMonth changeYear changeDecade changeCentury', function( event ) {that.calendarSettings.daysOfWeekDisabled = '';let $loading = $('
    ' + S123.s123IconToSvg.getHtml('spinner', 'fa-spin fa-2x') + '
    ');$calendar.parent().append($loading);setTimeout(function() {if ( event.type != 'show' ) {let startDate = dayjs(event.date).startOf('month');let maxDate = startDate.endOf('month');let lastDateOfMonth = dayjs(that.hoursInputSettings.pageLoadSettings.lastDateOfMonth);if ( maxDate.isAfter(lastDateOfMonth) || maxDate.isSame(lastDateOfMonth) ) {let serviceStaffMembers = [];that.$rootContainer.closest('.s123-module-schedule-bookingV2').find('.staffMemberSettings').each(function(index, staffMemberSettings) {staffMemberSettings = tryParseJSON($(staffMemberSettings).text());serviceStaffMembers.push(staffMemberSettings.uniqueID);});let newLastDateOfMonth = startDate.add(that.schedulesOffset.maxDate,'day').format('YYYY-MM-DD');$.ajax({url: '/versions/2/wizard/modules/scheduleBookingV2/get-scheduled-orders.php',method: 'post',data: that.hoursInputSettings.$form.serialize()+'&selectedDate='+encodeURIComponent(startDate.format('YYYY-MM-DD'))+'&lastDateOfMonth='+encodeURIComponent(newLastDateOfMonth)+'&cartType='+encodeURIComponent(that.moduleTypeNUM)+'&serviceTimeInterval='+encodeURIComponent(that.hoursInputSettings.timeInterval)+'&staffOrderFlow='+$('.staffOrderFlow').val()+'&serviceStaffMembers='+encodeURIComponent(JSON.stringify(serviceStaffMembers))+'&availability='+that.calendarSettings.availability+'&courseObject='+encodeURIComponent(JSON.stringify(that.calendarSettings.courseObject))}) .done(function(data) {data = tryParseJSON(data);that.hoursInputSettings.pageLoadSettings.orders = [...that.hoursInputSettings.pageLoadSettings.orders, ...data.orders];if ( data.sessions ) {if ( $.isArray(that.hoursInputSettings.pageLoadSettings.sessions) ) {that.hoursInputSettings.pageLoadSettings.sessions = [...that.hoursInputSettings.pageLoadSettings.sessions, ...data.sessions];} else {that.hoursInputSettings.pageLoadSettings.sessions = data.sessions;}} if ( data.resourceEvents ) {if ( $.isArray(that.hoursInputSettings.pageLoadSettings.resourceEvents) ) {that.hoursInputSettings.pageLoadSettings.resourceEvents = [...that.hoursInputSettings.pageLoadSettings.resourceEvents, ...data.resourceEvents];} else {that.hoursInputSettings.pageLoadSettings.resourceEvents = data.resourceEvents;}} that.hoursInputSettings.pageLoadSettings.lastDateOfMonth = newLastDateOfMonth;checkAndDisableDaysWithNoAvailableTimes($calendar,startDate,maxDate,dayjs(event.date).startOf('month'));$loading.remove();});} else {startDate = startDate.subtract(that.schedulesOffset.minDate, 'days');maxDate = maxDate.add(that.schedulesOffset.minDate, 'days');checkAndDisableDaysWithNoAvailableTimes($calendar,startDate,maxDate,dayjs(event.date).startOf('month'));$loading.remove();}} else {let startDate = dayjs(that.getDateAsIso(that.$hiddenInput.val())).startOf('month').subtract(that.schedulesOffset.minDate, 'days');let maxDate = dayjs(that.getDateAsIso(that.$hiddenInput.val())).endOf('month').add(that.schedulesOffset.minDate, 'days');checkAndDisableDaysWithNoAvailableTimes($calendar,startDate,maxDate,dayjs(that.getDateAsIso(that.$hiddenInput.val())).startOf('month'));$loading.remove();}},0);});} $calendar.datepicker({format: that.calendarSettings.format,weekStart: that.calendarSettings.firstDayOfWeek,todayBtn: that.calendarSettings.todayBtn,clearBtn: that.calendarSettings.clearBtn,language: that.calendarSettings.language,startDate: that.calendarSettings.startDate,todayHighlight: that.calendarSettings.todayHighlight,daysOfWeekDisabled: that.calendarSettings.daysOfWeekDisabled});return $calendar;};that.getMessageBody = function() {var html = '';html += '
    ';html += '
    ';html += '
    ';return $(html);};that.getDatePickerSupportedFormat = function ( format ) {return format == 'd/m/Y' ? 'DD/MM/YYYY' : 'MM/DD/YYYY';};that.getDateAsIso = function( date ) {switch ( that.calendarSettings.format ) {case 'MM/DD/YYYY':date = dayjs(date).format("YYYY-MM-DD");break;case 'DD/MM/YYYY':var newdate = date.split("/").reverse().join("-");date = dayjs(newdate).format("YYYY-MM-DD");break;} return date;};that.datePickerSubmit = function( calendar, modal ) {calendar.off('changeDate').on('changeDate', function(ev) {if ( $(this).attr('navigate-view-only') == 'true' ) {$(this).removeAttr('navigate-view-only');return;} if ( !that.onSubmit ) return;var selectedDate = calendar.datepicker('getDate');if ( !selectedDate ) selectedDate = new Date();var dayObj = dayjs(selectedDate);formattedSelectedDate = dayObj.format(that.calendarSettings.format);that.onSubmit.call(modal,formattedSelectedDate,selectedDate);if ( that.hoursInputSettings ) {that.$hiddenInput.val(formattedSelectedDate);that.HoursInput.init({...that.hoursInputOriginalSettings,isQuickDaysValidator: false});} if ( that.hoursInputSettings ) {initializeQuickAvailableDays({calendarSettings: that.calendarSettings,hoursInputSettings: that.hoursInputSettings,$moduleSelector: that.$moduleSelector,moduleID: that.moduleID,moduleTypeNUM: that.moduleTypeNUM,$rootContainer: that.$rootContainer,serviceDuration: that.$rootContainer.find('.serviceDuration').val(),timeBetweenService: that.$rootContainer.find('.timeBetweenService').val(),$serviceDatesContainer: that.$rootContainer.find('.serviceDatesContainer'),$serviceHourContainer: that.$rootContainer.find('.serviceHourContainer'),$tableHour: that.$rootContainer.find('.service-hour'),$input: that.$rootContainer.find('.real-input.c-h-input'),},dayjs(selectedDate).format('YYYY-MM-DD'));} modal.modal('hide');});};that.getCalendarTranslations = function() {return {days: [translations.calendarHandler.days.sunday,translations.calendarHandler.days.monday,translations.calendarHandler.days.tuesday,translations.calendarHandler.days.wednesday,translations.calendarHandler.days.thursday,translations.calendarHandler.days.friday,translations.calendarHandler.days.saturday],daysShort: [translations.calendarHandler.daysShort.sun,translations.calendarHandler.daysShort.mon,translations.calendarHandler.daysShort.tue,translations.calendarHandler.daysShort.wed,translations.calendarHandler.daysShort.thu,translations.calendarHandler.daysShort.fri,translations.calendarHandler.daysShort.sat,],daysMin: [translations.calendarHandler.daysMin.su,translations.calendarHandler.daysMin.mo,translations.calendarHandler.daysMin.tu,translations.calendarHandler.daysMin.we,translations.calendarHandler.daysMin.th,translations.calendarHandler.daysMin.fr,translations.calendarHandler.daysMin.sa,],months: [translations.calendarHandler.months.january,translations.calendarHandler.months.february,translations.calendarHandler.months.march,translations.calendarHandler.months.april,translations.calendarHandler.months.may,translations.calendarHandler.months.june,translations.calendarHandler.months.july,translations.calendarHandler.months.august,translations.calendarHandler.months.september,translations.calendarHandler.months.october,translations.calendarHandler.months.november,translations.calendarHandler.months.december],monthsShort: [translations.calendarHandler.monthsShort.jan,translations.calendarHandler.monthsShort.feb,translations.calendarHandler.monthsShort.mar,translations.calendarHandler.monthsShort.apr,translations.calendarHandler.monthsShort.may,translations.calendarHandler.monthsShort.jun,translations.calendarHandler.monthsShort.jul,translations.calendarHandler.monthsShort.aug,translations.calendarHandler.monthsShort.sep,translations.calendarHandler.monthsShort.oct,translations.calendarHandler.monthsShort.nov,translations.calendarHandler.monthsShort.dec],today: translations.calendarHandler.today,clear: translations.calendarHandler.clear,titleFormat: 'MM yyyy',};};that.isUnAvalible = function() {return that.inActiveDays == 7 || that.calendarSettings.availability == 'unavailable' || that.calendarSettings.isServiceUnavailable;};that.showUnavailableMsg = function() {that.$rootContainer.find('.c-h-widget').addClass('hidden');that.$rootContainer.find('.c-h-note-container').removeClass('hidden');};that.getSelectedDateTime = function() {var date = that.$rootContainer.find('.real-input.c-h-input').val();date = changeDateFormat('YYYY-mm-DD '+ that.calendarSettings.originalFormat,date);return dayjs(date + ' ' + that.$rootContainer.find('.service-hour').val()).format("YYYY-MM-DD HH:mm:ss");};that.getSelectedHour = function() {return that.$rootContainer.find('.service-hour').val();};that.getSelectedDate = function( formatDate ) {var date = that.$rootContainer.find('.real-input.c-h-input').val();if ( formatDate ) {date = changeDateFormat('YYYY-mm-DD '+ that.calendarSettings.originalFormat,date);} return date;};that.getDateDayName = function( dateTXT ) {let dayObj = dayjs(dateTXT);let calendarTranslationsOBJ = that.getCalendarTranslations();dayNameTXT = calendarTranslationsOBJ.days[dayObj.day()];return dayNameTXT;};function initializeBusinessHours() {that.inActiveDays = 0;if ( that.calendarSettings.availability == 'custom' ) {$.each(that.calendarSettings.businessHours,function( index, dayOfWeek) {if ( !dayOfWeek.isActive ) {that.inActiveDays ++;}});} if ( ['custom','bySchedule'].includes(that.calendarSettings.availability) ) {$.each(that.calendarSettings.businessHours, function( index, day ) {let lastShift = getLastActiveShift(day);var startShift = lastShift.start.name;var endShift = lastShift.end.name;if ( that.calendarSettings.businessHours[index].isActive && !day.hasNoShifts && day[endShift] <= day[startShift] ) {var startHour = parseInt(day[startShift].substring(0,2));var startMin = day[startShift].substring(3,5);var endHour = parseInt(day[endShift].substring(0,2));var endMin = day[endShift].substring(3,5);that.calendarSettings.businessHours[index][endShift] = '23:59';var dayIndex = (index+1);if ( index == 6 ) {dayIndex = 0;} if ( endHour < 10 ) endHour = '0' + endHour.toString();that.calendarSettings.businessHours[dayIndex].startTime0 = '00:' + startMin;that.calendarSettings.businessHours[dayIndex].endTime0 = endHour + ':' + endMin;if ( !that.calendarSettings.businessHours[dayIndex].isActive ) {that.calendarSettings.businessHours[dayIndex].isActive = true;that.calendarSettings.businessHours[dayIndex].startTime1 = '';that.calendarSettings.businessHours[dayIndex].endTime1 = '';that.calendarSettings.businessHours[dayIndex].startTime2 = '';that.calendarSettings.businessHours[dayIndex].endTime2 = '';that.calendarSettings.businessHours[dayIndex].startTime3 = '';that.calendarSettings.businessHours[dayIndex].endTime3 = '';that.calendarSettings.businessHours[dayIndex].hasNoShifts = true;}}});} else if ( ['fullTime','bySchedule'].includes(that.calendarSettings.availability) ) {$.each(that.calendarSettings.businessHours,function( index, weekday ) {weekday.isActive = true;weekday.startTime1 ='00:00';weekday.endTime1 ='24:00';weekday.startTime2 ='';weekday.endTime2 ='';weekday.startTime3 ='';weekday.endTime3 ='';});}} function getLastActiveShift( day ) {var businessDay = JSON.parse(JSON.stringify(day));delete businessDay.isActive;delete businessDay.startTime0;delete businessDay.endTime0;let lastShift = {start: {name: '',value: ''},end: {name: '',value: ''}};let numberOfShifts = (Object.keys(businessDay).length) / 2;for (let i = numberOfShifts; i >= 0; i--) {if ( businessDay[`startTime${i}`] !== "" && businessDay[`endTime${i}`] !== "" ) {lastShift.start.name = `startTime${i}`;lastShift.start.value = businessDay[`startTime${i}`];lastShift.end.name = `endTime${i}`;lastShift.end.value = businessDay[`endTime${i}`];break;}} return lastShift;} function changeDateFormat( websiteDateFormat, date ) {switch( websiteDateFormat ) {case 'YYYY-mm-DD m/d/Y':return dayjs(date).format("YYYY-MM-DD");break;case 'YYYY-mm-DD d/m/Y':var newdate = date.split("/").reverse().join("-");return dayjs(newdate).format("YYYY-MM-DD");break;}} function checkAndDisableDaysWithNoAvailableTimes( $calendar, baseDate, maxDateToCheck, calendarFirstDayOfMonth ) {let today = dayjs();if ( today.isAfter(baseDate) ) {baseDate = today;} const originalValue = that.$hiddenInput.val();let dayIndex = 0;const datesToDisable = {};const activeDates = {};const hoursInputSettings = {calendarSettings: that.calendarSettings,hoursInputSettings: {...that.hoursInputSettings,onHoursLoad: function( chWidget, $tableHour ) {let isDayAvailable = $tableHour.find('option:not([value=""])').length > 0;const dateToCheck = that.$hiddenInput.val();const isoDate = that.getDateAsIso(dateToCheck);const dateObj = new Date(isoDate);if ( that.calendarSettings.availability != 'bySchedule' ) {if ( !that.calendarSettings.businessHours[dayjs(isoDate).day()].isActive ) {isDayAvailable = false;}} if ( !isDayAvailable ) {if ( !datesToDisable[isoDate] ) {datesToDisable[isoDate] = dateObj;}} else {if ( !activeDates[isoDate] ) {activeDates[isoDate] = dateObj;}} dayIndex++;let nextDay = baseDate.add(dayIndex,'day');if ( !nextDay.isAfter(maxDateToCheck) ) {checkDay(nextDay);} if ( that.originalOnHoursLoad ) that.originalOnHoursLoad.call(this,that,$tableHour);}},$moduleSelector: that.$moduleSelector,moduleID: that.moduleID,moduleTypeNUM: that.moduleTypeNUM,$rootContainer: that.$rootContainer,serviceDuration: that.$rootContainer.find('.serviceDuration').val(),timeBetweenService: that.$rootContainer.find('.timeBetweenService').val(),$serviceDatesContainer: that.$rootContainer.find('.serviceDatesContainer'),$serviceHourContainer: that.$rootContainer.find('.serviceHourContainer'),$tableHour: that.$rootContainer.find('.service-hour'),$input: that.$rootContainer.find('.real-input.c-h-input')};checkDay(baseDate);if ( Object.keys(datesToDisable).length > 0 ) {$calendar.datepicker('setDatesDisabled',Object.values(datesToDisable));$.each(activeDates,function(key,value) {if ( dayjs(key).isBefore(calendarFirstDayOfMonth) ) {delete activeDates[key];}});$calendar.attr('navigate-view-only','true');if ( Object.values(activeDates).length > 0 ) {$calendar.datepicker('setDate',new Date(dayjs(Object.values(activeDates)[0]).format('YYYY-MM-DD')));} else {$calendar.datepicker('setDate',new Date(calendarFirstDayOfMonth.format('YYYY-MM-DD')));}} that.$hiddenInput.val(originalValue);that.HoursInput.init({...that.hoursInputOriginalSettings,isQuickDaysValidator: true});function checkDay( dateToCheck ) {that.$hiddenInput.val(dateToCheck.format(that.calendarSettings.format));that.HoursInput.init({...hoursInputSettings,isQuickDaysValidator: true});}} that.HoursInput = function() {var _ = {isInitialized: false,calendarSettings: {},onInit: false,onHoursLoad: false,onHoursChage: false,$input: null,moduleID: null,moduleTypeNUM: null,isPageLoad: true,isQuickDaysValidator: false,};_.init = function( settings ) {_.onInit = settings.onInit;_.moduleID = settings.moduleID;_.moduleTypeNUM = settings.moduleTypeNUM;_.calendarSettings = settings.calendarSettings;_.$form = settings.hoursInputSettings.$form;_.onHoursLoad = settings.hoursInputSettings.onHoursLoad;_.onHoursChage = settings.hoursInputSettings.onHoursChage;_.maxParticipants = settings.hoursInputSettings.maxParticipants;_.timeInterval = settings.hoursInputSettings.timeInterval;_.pageLoadSettings = settings.hoursInputSettings.pageLoadSettings;_.$moduleSelector = settings.$moduleSelector;_.isQuickDaysValidator = settings.isQuickDaysValidator;_.$rootContainer = settings.$rootContainer;_.serviceDuration = settings.serviceDuration;_.timeBetweenService = settings.timeBetweenService;_.$serviceDatesContainer = settings.$serviceDatesContainer;_.$serviceHourContainer = settings.$serviceHourContainer;_.$tableHour = settings.$tableHour;_.$input = settings.$input;_.isPageLoad = true;refreshBusinessHours();};function refreshBusinessHours () {var $input = _.$input;var selectedDate = $input.val();selectedDate = changeDateFormat('YYYY-mm-DD '+ _.calendarSettings.originalFormat,selectedDate);var today = new Date(selectedDate);var lastDateOfMonth = new Date(today);lastDateOfMonth.setDate(lastDateOfMonth.getDate() + that.schedulesOffset.maxDate);lastDateOfMonth.setHours(23, 59, 59);lastDateOfMonth = getDateFormat(lastDateOfMonth) +' '+ getHourFromDate(lastDateOfMonth);if ( _.$tableHour.data('tomselect') ) {_.$tableHour.data('tomselect').destroy();} _.$tableHour.empty();showHoursLoading();let serviceStaffMembers = [];_.$rootContainer.closest('.s123-module-schedule-bookingV2').find('.staffMemberSettings').each(function(index, staffMemberSettings) {staffMemberSettings = tryParseJSON($(staffMemberSettings).text());serviceStaffMembers.push(staffMemberSettings.uniqueID);});if (_.isPageLoad && _.pageLoadSettings) {ordersLoadedCallback(_.pageLoadSettings);_.isPageLoad = false;} else {$.ajax({url: '/versions/2/wizard/modules/scheduleBookingV2/get-scheduled-orders.php',method: 'post',data: _.$form.serialize()+'&selectedDate='+encodeURIComponent(selectedDate)+'&lastDateOfMonth='+encodeURIComponent(lastDateOfMonth)+'&cartType='+encodeURIComponent(_.moduleTypeNUM)+'&serviceTimeInterval='+encodeURIComponent(_.timeInterval)+'&staffOrderFlow='+$('.staffOrderFlow').val()+'&serviceStaffMembers='+encodeURIComponent(JSON.stringify(serviceStaffMembers))+'&availability='+_.calendarSettings.availability+'&courseObject='+encodeURIComponent(JSON.stringify(_.calendarSettings.courseObject)),}) .done(function(data) {data = tryParseJSON(data);ordersLoadedCallback(data);}) .fail(function() {hideHoursLoading();});} function ordersLoadedCallback(data) {_.$serviceDatesContainer.data('corrent-time', data.userTime);if (_.calendarSettings.availability == 'bySchedule') {buildSessionsHourSelectBox(data.sessions);} else {buildHourSelectBox(data.orders);} removeUnavailableHours(data.orders,data.resourceEvents);if ( !_.isQuickDaysValidator ) {if ( _.$tableHour.find('option').length <= 0 ) {_.$tableHour.addClass('hidden');_.$serviceHourContainer.find('.no-time-available').removeClass('hidden');_.$serviceHourContainer.find('.quick-time-slots-container').remove();} else {_.$tableHour.removeClass('hidden');_.$serviceHourContainer.find('.no-time-available').addClass('hidden');_.$tableHour.prepend('');new UiRichSelect();initQuickTimeButtons();} if ( !_.isInitialized ) {if (_.onInit) _.onInit.call(this);_.isInitialized = true;}} if ( _.onHoursLoad ) _.onHoursLoad.call(this, that, _.$tableHour);if ( _.isPageLoad ) {setTimeout(() => {hideHoursLoading();},100);} else {hideHoursLoading();}} function getHourFromDate( DateChoosed ) {var hourFormat = DateChoosed;var hours = hourFormat.getHours();if ( hours < 10 ) hours = '0' + hours;var minutes = hourFormat.getMinutes();if ( minutes < 10 ) minutes = '0' + minutes;miliSeconds = hourFormat.getMilliseconds();if ( miliSeconds < 10 ) miliSeconds = '0' + miliSeconds;return hours + ':' + minutes + ':' + miliSeconds;} function removeUnavailableHours( unavailableHours, resourceEvents ) {var selectedDate = _.$input.val();selectedDate = changeDateFormat('YYYY-mm-DD '+ _.calendarSettings.originalFormat, selectedDate);var serviceDurationHour = _.serviceDuration.substring(0,2);var serviceDurationMin = _.serviceDuration.substring(3,5);var timeBetweenService = parseInt(_.timeBetweenService) * 60 * 1000;var serviceDurationHourMili = parseInt(serviceDurationHour) * 60 * 60 * 1000;var serviceDurationMinutesMili = parseInt(serviceDurationMin) * 60 * 1000;var serviceDurationInMili = serviceDurationHourMili + serviceDurationMinutesMili + timeBetweenService;let timesToRemove = {};if ( ['byStaffDateFirst','autoStaffByDate'].includes(that.calendarSettings.staffOrderFlow) ) {fillTimesToRemove(that.$moduleSelector.find('.staff-members-container .staff-member-card'));} else {fillTimesToRemove(that.$moduleSelector.find('.staff-members-container .staff-member-card[data-item-tool-staff-id="'+_.$form.find('[name="item_tool_staff_id"]').val()+'"]'));} removeOptions('businessHours');if ( S123.QueryString.reschedule == 1 && selectedDate == dayjs(S123.QueryString.currentDate).format('YYYY-MM-DD') ) {timesToRemove[dayjs(S123.QueryString.currentDate).format('HH:mm')] = {time: dayjs(S123.QueryString.currentDate).format('HH:mm'),count: 1,isForceRemove: true};removeOptions('reschedule');} if ( _.calendarSettings.availability != 'bySchedule' ) {if ( that.calendarSettings.resourceTypes && Array.isArray(that.calendarSettings.resourceTypes) ) {if ( resourceEvents && Array.isArray(resourceEvents) && resourceEvents.length > 0 ) {_.$tableHour.find('option').each(function() {let option = $(this);let timeValue = option.val();if ( !timeValue ) return;let optionTime = dayjs(selectedDate + ' ' + timeValue);let optionEnd = optionTime.add(serviceDurationInMili, 'millisecond');let resourceUsage = {};that.calendarSettings.resourceTypes.forEach(resourceType => {resourceUsage[resourceType] = 0;});resourceEvents.forEach(( event ) => {let eventStart = dayjs(event.startDateFUN);let eventEnd = dayjs(event.endDateFUN);if ( isOptionIntersectinWithService({start: optionTime.valueOf(),end: optionEnd.valueOf()}, {start: eventStart.valueOf(),end: eventEnd.valueOf(),obj: event})) {if ( event.resources && Array.isArray(event.resources) ) {event.resources.forEach(resource => {const totalItems = parseInt(resource.totalItems) || 0;if ( totalItems == 0 ) return;let isRemoveOption = false;if ( !resourceUsage[resource.resourceTypeID] ) {resourceUsage[resource.resourceTypeID] = 0;} const resourcesInUse = parseInt(resource.resourcesInUse) || 0;resourceUsage[resource.resourceTypeID] += resourcesInUse;isRemoveOption = resourceUsage[resource.resourceTypeID] >= totalItems;if ( isRemoveOption && option.data('multiple-participants-resources-handler') ) {isRemoveOption = false;let availableStaff = option.data('available-staff');$.each(availableStaff,function(index,staff) {let isRemoveStaff = false;if ( option.data('multiple-participants-resources-handler').staffCount[staff.id] >= _.maxParticipants ) {isRemoveStaff = true;} if ( !option.data('multiple-participants-resources-handler').staffCount[staff.id] ) {isRemoveStaff = true;} if ( isRemoveStaff ) {availableStaff = availableStaff.filter(availableStaff => availableStaff.id != staff.id);option.data('available-staff',availableStaff);option.attr('data-available-staff',JSON.stringify(availableStaff));}});if ( availableStaff.length == 0 ) {isRemoveOption = true;}} if ( isRemoveOption ) {timesToRemove[timeValue] = {time: timeValue,count: 1,isForceRemove: true,obj: [event]};}});}}});});removeOptions('resources');}}} function fillTimesToRemove( $staffMembers ) {let staffMembers = $staffMembers.map(function() {return {id: $(this).data('item-tool-staff-id'),fname: $(this).find('.staff-member-name').text(),businessHours: StaffMembersHelpers.getStaffSettings(that.$moduleSelector,$(this).data('item-tool-staff-id'),'businessHours'),unavailableHours: unavailableHours.filter(( unavailableHour ) => {return unavailableHour.item_tool_staff_id == $(this).data('item-tool-staff-id');})};}).get();_.$tableHour.find('option').each(function() {let option = $(this);let timeValue = option.val();if ( !timeValue ) return;let optionTimeStart = dayjs(selectedDate + ' ' + timeValue);let dayOfWeek = optionTimeStart.day();let availableStaff = [];staffMembers.forEach((staff) => {let staffObject = {id: staff.id,fname: staff.fname,remainingCapacity: _.maxParticipants};if ( that.calendarSettings.availability != 'bySchedule' ) {if ( !staff.businessHours[dayOfWeek].isActive || !isWithinBusinessHours(optionTimeStart, staff.businessHours[dayOfWeek]) ) {return;}} if ( that.calendarSettings.availability == 'bySchedule' && !option.data('related-schedules').find(( relatedSchedule ) => {return relatedSchedule.item_tool_staff_id == staffObject.id;}) ) return;if ( staff.unavailableHours.length == 0 ) {availableStaff.push(staffObject);return;} let isStaffMemberAvailable = true;let timeMaxParticipants = _.maxParticipants;$.each(staff.unavailableHours.filter(( unavailableHour ) => {return dayjs(unavailableHour.orderDate).valueOf() == optionTimeStart;}), ( index, unavailableHour ) => {let orderDate = dayjs(unavailableHour.orderDate).valueOf();if ( orderDate != optionTimeStart ) {return;} else if ( orderDate == optionTimeStart && that.itemID != unavailableHour.itemID ) {timeMaxParticipants = 0;return;} timeMaxParticipants --;});if ( timeMaxParticipants <= 0 ) {isStaffMemberAvailable = false;} $.each(staff.unavailableHours.filter(( unavailableHour ) => {return dayjs(unavailableHour.orderDate).valueOf() != optionTimeStart;}), ( index, unavailableHour ) => {let orderDate = dayjs(unavailableHour.orderDate).valueOf();let orderDuration = dayjs(unavailableHour.endOrderDate).valueOf() - orderDate + timeBetweenService;if ( selectedDate == dayjs(unavailableHour.orderDate).format('YYYY-MM-DD') && unavailableHour.isAllDayEvent ) {isStaffMemberAvailable = false;return false;} if ( isOptionIntersectinWithService({start: optionTimeStart,end: optionTimeStart + serviceDurationInMili}, {start: orderDate,end: orderDate + orderDuration,obj: unavailableHour}) ) {isStaffMemberAvailable = false;return false;}});if ( isStaffMemberAvailable ) {availableStaff.push(staffObject);}});if ( availableStaff.length > 0 ) {option.attr('data-available-staff',JSON.stringify(availableStaff));} else {if ( !timesToRemove[timeValue] ) {timesToRemove[timeValue] = {time: timeValue,count: unavailableHours.length,obj: [...unavailableHours],isForceRemove: true // set to maximum participants so block engine will remove the time };}}});} function removeOptions( validatorType ) {if ( Object.keys(timesToRemove).length > 0 ) {_.$tableHour.find('option').each(function() {let $option = $(this);let timeValue = $option.val();if ( !timesToRemove[timeValue] ) return;if ( timesToRemove[timeValue].count >= _.maxParticipants ) {$option.remove();} else if ( timesToRemove[timeValue].isForceRemove ) {$option.remove();}});timesToRemove = {};}} function isWithinBusinessHours(time, businessHours) {for (let i = 0; i < 4; i++) {let start = businessHours[`startTime${i}`];let end = businessHours[`endTime${i}`];if (start && end) {let startTime = dayjs(time.format('YYYY-MM-DD') + ' ' + start);let endTime = dayjs(time.format('YYYY-MM-DD') + ' ' + end);if (time.valueOf() >= startTime.valueOf() && time.add(serviceDurationInMili, 'millisecond').valueOf() <= endTime.valueOf()) {return true;}}} return false;} function isOptionIntersectinWithService( option, order ) {if ( option.start >= order.start && option.start < order.end ) {return true;} else if ( option.end > order.start && option.end <= order.end ) {return true;} else if ( option.start < order.start && option.end > order.end ) {return true;} else if ( option.start >= order.start && option.end <= order.end ) {return true;} else if ( option.start === order.start && option.end === order.end ) {return true;} if ( order.obj.isAllDayEvent && selectedDate == dayjs(order.start).format('YYYY-MM-DD') ) {return true;} return false;} return resourceEvents;} function buildHourSelectBox( unavailableHours ) {var serviceDurationHour = _.serviceDuration.substring(0,2);var serviceDurationHourMili = parseInt(serviceDurationHour) * 60 * 60 * 1000;var serviceDurationMin = _.serviceDuration.substring(3,5);var serviceDurationMinutesMili = parseInt(serviceDurationMin) * 60 * 1000;var serviceInterval = parseInt(_.timeInterval) * 60 * 1000;var dateFromCalendar = changeDateFormat( 'YYYY-mm-DD '+ _.calendarSettings.originalFormat,_.$input.val());if ( !dateFromCalendar ) throw 'Missing date parameter';let multipleParticipantsResourcesDateHandler = {};if ( _.maxParticipants > 1 ) {$.each(unavailableHours,function(index,order) {let orderHour = dayjs(order.orderDate).format('HH:mm');if ( dayjs(order.orderDate).format('YYYY-MM-DD') == dateFromCalendar ) {if ( !multipleParticipantsResourcesDateHandler[orderHour] ) {multipleParticipantsResourcesDateHandler[orderHour] = {staffCount: {}};} if ( !multipleParticipantsResourcesDateHandler[orderHour].staffCount[order.item_tool_staff_id] ) {multipleParticipantsResourcesDateHandler[orderHour].staffCount[order.item_tool_staff_id] = 0;} multipleParticipantsResourcesDateHandler[orderHour].staffCount[order.item_tool_staff_id]++;}});} var dataIndex = dayjs(dateFromCalendar).day();if (that.staffAvailability) {that.staffAvailability.clear();} let allStaffIds = [];if (['byStaffDateFirst','autoStaffByDate'].includes(that.calendarSettings.staffOrderFlow) && that.$moduleSelector) {allStaffIds = that.$moduleSelector.find('.staff-members-container').find('.staff-member-card').map(function() {return {id: $(this).data('item-tool-staff-id'),businessHours: StaffMembersHelpers.getStaffSettings(that.$moduleSelector,$(this).data('item-tool-staff-id'),'businessHours')};}).get();} for ( var i = 0; i <= that.maxShiftsAmount; i++ ) {var startTime = 'startTime' + i;var endTime = 'endTime' + i;startTime = _.calendarSettings.businessHours[dataIndex][startTime];endTime = _.calendarSettings.businessHours[dataIndex][endTime];if ( startTime == ''|| endTime == '' || !_.calendarSettings.businessHours[dataIndex].isActive ) continue;var selectedDate = new Date(dateFromCalendar);if ( getDateFormat(selectedDate) == getDateFormat(new Date()) && new Date().getTime() >= dayjs(dateFromCalendar + " " + startTime).valueOf()) {startTime = dayjs(dateFromCalendar + " " + _.$serviceDatesContainer.data('corrent-time')).valueOf();} else {startTime = dayjs(dateFromCalendar + " " + startTime).valueOf();} endTime = dayjs(dateFromCalendar + " " + endTime).valueOf();for ( ;startTime <= (endTime-serviceDurationHourMili-serviceDurationMinutesMili) ; startTime += serviceInterval ) {var newdate = new Date(startTime);var newHour = newdate.getHours();var newMinutes = newdate.getMinutes();if (newHour.toString().length == 1 ) newHour = '0' + newHour;if (newMinutes.toString().length == 1 ) newMinutes = '0' + newMinutes;var fullHour = newHour+':'+newMinutes;var hourExists = false;$.each(_.$tableHour.find('option'),function(index) {let $optionVal = $(this).val();$(this).data('multiple-participants-resources-handler',multipleParticipantsResourcesDateHandler[$optionVal]);$(this).attr('data-multiple-participants-resources-handler',JSON.stringify(multipleParticipantsResourcesDateHandler[$optionVal]));if ( $optionVal == fullHour ) {hourExists = true;return false;}});let staffAvailable = true;if (['byStaffDateFirst', 'autoStaffByDate'].includes(that.calendarSettings.staffOrderFlow) && allStaffIds.length > 0) {staffAvailable = allStaffIds.some(staff => {if (!staff.businessHours[dataIndex].isActive) {return false;} const timeObj = dayjs(dateFromCalendar + ' ' + fullHour);for (let j = 0; j < 4; j++) {const shiftStart = staff.businessHours[dataIndex][`startTime${j}`];const shiftEnd = staff.businessHours[dataIndex][`endTime${j}`];if (shiftStart && shiftEnd) {const shiftStartMs = dayjs(dateFromCalendar + ' ' + shiftStart).valueOf();const shiftEndMs = dayjs(dateFromCalendar + ' ' + shiftEnd).valueOf();const timeMs = timeObj.valueOf();const endTimeMs = timeMs + serviceDurationHourMili + serviceDurationMinutesMili;if (timeMs >= shiftStartMs && endTimeMs <= shiftEndMs) {return true;}}} return false;});} if (!hourExists && staffAvailable) {let $option = $('');$option.data('multiple-participants-resources-handler',multipleParticipantsResourcesDateHandler[newHour+':'+newMinutes]);$option.attr('data-multiple-participants-resources-handler',JSON.stringify(multipleParticipantsResourcesDateHandler[newHour+':'+newMinutes]));_.$tableHour.append($option);}}} function changeTimeFormat( websiteTimeFormat, date ) {var dayObj = dayjs(date);if ( websiteTimeFormat === 'H:i' ) {return dayObj.format('HH:mm');} else if ( websiteTimeFormat === 'h:i A' ) {return dayObj.format('hh:mm A');}} _.$tableHour.off('change').on('change', function( event ) {if ( _.onHoursChage ) _.onHoursChage.call(this,$(this).val(),$(this).find('option:selected'));});} function initQuickTimeButtons() {_.$serviceHourContainer.find('.quick-time-slots-container').remove();_.$serviceHourContainer.removeClass('quick-time-mode');const $timeOptions = $(Object.values(_.$tableHour.data('tomselect').options).map(option => {return option.$option}));if ( $timeOptions.length <= 15 && $timeOptions.length > 0 ) {let $quickTimeContainer = $('
    ');_.$serviceHourContainer.append($quickTimeContainer);$timeOptions.each(function() {const $option = $(this);const timeValue = $option.val();const displayTime = $option.text();if ( !timeValue || ($option.attr('data-available-staff') === '[]') ) {return;} const $button = $(``);$.each($option.data(), function(key, value) {if ( typeof value === 'object' ) {$button.attr('data-' + key, JSON.stringify(value));} else {$button.attr('data-' + key, value);}});$button.on('click', function() {_.$tableHour.data('tomselect').setValue($(this).data('time'));$quickTimeContainer.find('.quick-time-btn').removeClass('active');$(this).addClass('active');});$quickTimeContainer.append($button);});_.$serviceHourContainer.addClass('quick-time-mode');}} function buildSessionsHourSelectBox( sessions ) {var dateFromCalendar = changeDateFormat( 'YYYY-mm-DD '+ _.calendarSettings.originalFormat,_.$input.val());var dayOfWeek = dayjs(dateFromCalendar).day();let startTime = dayjs(dateFromCalendar + " " + _.$serviceDatesContainer.data('corrent-time')).valueOf();$.each(sessions, function( index, session ) {if ( dayOfWeek != dayjs(session.startDateFUN).day() ) return;if ( dateFromCalendar != dayjs(session.startDateFUN).format('YYYY-MM-DD') ) return;let sessionTime = dayjs(`${session.startDateFUN}`).format('HH:mm');if ( dayjs().format('YYYY-MM-DD') == dayjs(`${session.startDateFUN}`).format('YYYY-MM-DD') ) {if ( dayjs(`${session.startDateFUN}`).valueOf() < startTime ) return;} let $option = _.$tableHour.find('option[value="'+sessionTime+'"]');if ( $option.length > 0 ) {$option.data('related-schedules').push({eventID: session.eventID,duration: session.duration,item_tool_staff_id: session.item_tool_staff_id});$option.attr('data-related-schedules',JSON.stringify($option.data('related-schedules')));} else {_.$tableHour.append('');}});_.$tableHour.off('change').on('change', function( event ) {if ( _.onHoursChage ) _.onHoursChage.call(this,$(this).val(),$(this).find('option:selected'));});}};_.isServiceAvalible = function() {return _.$tableHour.find('option').length > 0;};function getDateFormat( DateChoosed ) {var formattedDate = DateChoosed;var day = formattedDate.getDate();if ( day < 10 ) day = '0'+day;var month = (formattedDate.getMonth() + 1);if ( month < 10 ) month = '0'+month;var year = formattedDate.getFullYear();return year +'-'+ month + '-'+ day;} function showHoursLoading() {const $hoursContainer = that.$rootContainer.find('.serviceHourContainer');$hoursContainer.addClass('loading');if ( $hoursContainer.find('.hours-loading-overlay').length === 0 ) {const $loadingOverlay = $('
    ' + S123.s123IconToSvg.getHtml('spinner', 'fa-spin fa-2x') + '
    ');$hoursContainer.append($loadingOverlay);} else {$hoursContainer.find('.hours-loading-overlay').show();}} function hideHoursLoading() {const $hoursContainer = that.$rootContainer.find('.serviceHourContainer');$hoursContainer.removeClass('loading');const $spinner = $hoursContainer.find('.hours-loading-overlay');if ( $spinner.length > 0 ) {$spinner.remove();}} return _;}();that.init();} (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Pjax=f()}})(function(){var define,module,exports;return function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i]+>/gi;var htmlAttribsRegex=/\s?[a-z:]+(?:=['"][^'">]+['"])*/gi;var matches=html.match(htmlRegex);if(matches&&matches.length){matches=matches[0].match(htmlAttribsRegex);if(matches.length){matches.shift();matches.forEach(function(htmlAttrib){var attr=htmlAttrib.trim().split("=");if(attr.length===1){tmpEl.documentElement.setAttribute(attr[0],true)}else{tmpEl.documentElement.setAttribute(attr[0],attr[1].slice(1,-1))}})}}tmpEl.documentElement.innerHTML=html;this.log("load content",tmpEl.documentElement.attributes,tmpEl.documentElement.innerHTML.length);if(document.activeElement&&contains(document,this.options.selectors,document.activeElement)){try{document.activeElement.blur()}catch(e){}}this.switchSelectors(this.options.selectors,tmpEl,document,options)},abortRequest:require("./lib/abort-request"),doRequest:require("./lib/send-request"),handleResponse:require("./lib/proto/handle-response"),loadUrl:function(href,options){options=typeof options==="object"?extend({},this.options,options):clone(this.options);this.log("load href",href,options);this.abortRequest(this.request);trigger(document,"pjax:send",options);this.request=this.doRequest(href,options,this.handleResponse.bind(this))},afterAllSwitches:function(){var autofocusEl=Array.prototype.slice.call(document.querySelectorAll("[autofocus]")).pop();if(autofocusEl&&document.activeElement!==autofocusEl){autofocusEl.focus()}this.options.selectors.forEach(function(selector){forEachEls(document.querySelectorAll(selector),function(el){executeScripts(el)})});var state=this.state;if(state.options.history){if(!window.history.state){this.lastUid=this.maxUid=newUid();window.history.replaceState({url:window.location.href,title:document.title,uid:this.maxUid,scrollPos:[0,0]},document.title)}this.lastUid=this.maxUid=newUid();window.history.pushState({url:state.href,title:state.options.title,uid:this.maxUid,scrollPos:[0,0]},state.options.title,state.href)}this.forEachSelectors(function(el){this.parseDOM(el)},this);trigger(document,"pjax:complete pjax:success",state.options);if(typeof state.options.analytics==="function"){state.options.analytics()}if(state.options.history){var a=document.createElement("a");a.href=this.state.href;if(a.hash){var name=a.hash.slice(1);name=decodeURIComponent(name);var curtop=0;var target=document.getElementById(name)||document.getElementsByName(name)[0];if(target){if(target.offsetParent){do{curtop+=target.offsetTop;target=target.offsetParent}while(target)}}window.scrollTo(0,curtop)}else if(state.options.scrollTo!==false){if(state.options.scrollTo.length>1){window.scrollTo(state.options.scrollTo[0],state.options.scrollTo[1])}else{window.scrollTo(0,state.options.scrollTo)}}}else if(state.options.scrollRestoration&&state.options.scrollPos){window.scrollTo(state.options.scrollPos[0],state.options.scrollPos[1])}this.state={numPendingSwitches:0,href:null,options:null}}};Pjax.isSupported=require("./lib/is-supported");if(Pjax.isSupported()){module.exports=Pjax}else{var stupidPjax=noop;for(var key in Pjax.prototype){if(Pjax.prototype.hasOwnProperty(key)&&typeof Pjax.prototype[key]==="function"){stupidPjax[key]=noop}}module.exports=stupidPjax}},{"./lib/abort-request":2,"./lib/events/on":4,"./lib/events/trigger":5,"./lib/execute-scripts":6,"./lib/foreach-els":7,"./lib/foreach-selectors":8,"./lib/is-supported":9,"./lib/parse-options":10,"./lib/proto/attach-form":11,"./lib/proto/attach-link":12,"./lib/proto/handle-response":13,"./lib/proto/log":14,"./lib/proto/parse-element":15,"./lib/send-request":16,"./lib/switches":18,"./lib/switches-selectors":17,"./lib/uniqueid":19,"./lib/util/clone":20,"./lib/util/contains":21,"./lib/util/extend":22,"./lib/util/noop":23}],2:[function(require,module,exports){var noop=require("./util/noop");module.exports=function(request){if(request&&request.readyState<4){request.onreadystatechange=noop;request.abort()}}},{"./util/noop":23}],3:[function(require,module,exports){module.exports=function(el){var code=el.text||el.textContent||el.innerHTML||"";var src=el.src||"";var parent=el.parentNode||document.querySelector("head")||document.documentElement;var script=document.createElement("script");if(code.match("document.write")){if(console&&console.log){console.log("Script contains document.write. Can’t be executed correctly. Code skipped ",el)}return false}script.type="text/javascript";script.id=el.id;if(src!==""){script.src=src;script.async=false}if(code!==""){try{script.appendChild(document.createTextNode(code))}catch(e){script.text=code}}parent.appendChild(script);if((parent instanceof HTMLHeadElement||parent instanceof HTMLBodyElement)&&parent.contains(script)){parent.removeChild(script)}return true}},{}],4:[function(require,module,exports){var forEachEls=require("../foreach-els");module.exports=function(els,events,listener,useCapture){events=typeof events==="string"?events.split(" "):events;events.forEach(function(e){forEachEls(els,function(el){el.addEventListener(e,listener,useCapture)})})}},{"../foreach-els":7}],5:[function(require,module,exports){var forEachEls=require("../foreach-els");module.exports=function(els,events,opts){events=typeof events==="string"?events.split(" "):events;events.forEach(function(e){var event;event=document.createEvent("HTMLEvents");event.initEvent(e,true,true);event.eventName=e;if(opts){Object.keys(opts).forEach(function(key){event[key]=opts[key]})}forEachEls(els,function(el){var domFix=false;if(!el.parentNode&&el!==document&&el!==window){domFix=true;document.body.appendChild(el)}el.dispatchEvent(event);if(domFix){el.parentNode.removeChild(el)}})})}},{"../foreach-els":7}],6:[function(require,module,exports){var forEachEls=require("./foreach-els");var evalScript=require("./eval-script");module.exports=function(el){if(el.tagName.toLowerCase()==="script"){evalScript(el)}forEachEls(el.querySelectorAll("script"),function(script){if(!script.type||script.type.toLowerCase()==="text/javascript"){if(script.parentNode){script.parentNode.removeChild(script)}evalScript(script)}})}},{"./eval-script":3,"./foreach-els":7}],7:[function(require,module,exports){module.exports=function(els,fn,context){if(els instanceof HTMLCollection||els instanceof NodeList||els instanceof Array){return Array.prototype.forEach.call(els,fn,context)}return fn.call(context,els)}},{}],8:[function(require,module,exports){var forEachEls=require("./foreach-els");module.exports=function(selectors,cb,context,DOMcontext){DOMcontext=DOMcontext||document;selectors.forEach(function(selector){forEachEls(DOMcontext.querySelectorAll(selector),cb,context)})}},{"./foreach-els":7}],9:[function(require,module,exports){module.exports=function(){return window.history&&window.history.pushState&&window.history.replaceState&&!navigator.userAgent.match(/((iPod|iPhone|iPad).+\bOS\s+[1-4]\D|WebApps\/.+CFNetwork)/)}},{}],10:[function(require,module,exports){var defaultSwitches=require("./switches");module.exports=function(options){options=options||{};options.elements=options.elements||"a[href], form[action]";options.selectors=options.selectors||["title",".js-Pjax"];options.switches=options.switches||{};options.switchesOptions=options.switchesOptions||{};options.history=typeof options.history==="undefined"?true:options.history;options.analytics=typeof options.analytics==="function"||options.analytics===false?options.analytics:defaultAnalytics;options.scrollTo=typeof options.scrollTo==="undefined"?0:options.scrollTo;options.scrollRestoration=typeof options.scrollRestoration!=="undefined"?options.scrollRestoration:true;options.cacheBust=typeof options.cacheBust==="undefined"?true:options.cacheBust;options.debug=options.debug||false;options.timeout=options.timeout||0;options.currentUrlFullReload=typeof options.currentUrlFullReload==="undefined"?false:options.currentUrlFullReload;if(!options.switches.head){options.switches.head=defaultSwitches.switchElementsAlt}if(!options.switches.body){options.switches.body=defaultSwitches.switchElementsAlt}return options};function defaultAnalytics(){if(window._gaq){_gaq.push(["_trackPageview"])}if(window.ga){ga("send","pageview",{page:location.pathname,title:document.title})}}},{"./switches":18}],11:[function(require,module,exports){var on=require("../events/on");var clone=require("../util/clone");var attrState="data-pjax-state";var formAction=function(el,event){if(isDefaultPrevented(event)){return}var options=clone(this.options);options.requestOptions={requestUrl:el.getAttribute("action")||window.location.href,requestMethod:el.getAttribute("method")||"GET"};var virtLinkElement=document.createElement("a");virtLinkElement.setAttribute("href",options.requestOptions.requestUrl);var attrValue=checkIfShouldAbort(virtLinkElement,options);if(attrValue){el.setAttribute(attrState,attrValue);return}event.preventDefault();if(el.enctype==="multipart/form-data"){options.requestOptions.formData=new FormData(el)}else{options.requestOptions.requestParams=parseFormElements(el)}el.setAttribute(attrState,"submit");options.triggerElement=el;this.loadUrl(virtLinkElement.href,options)};function parseFormElements(el){var requestParams=[];var formElements=el.elements;for(var i=0;i1||event.metaKey||event.ctrlKey||event.shiftKey||event.altKey){return"modifier"}if(el.protocol!==window.location.protocol||el.host!==window.location.host){return"external"}if(el.hash&&el.href.replace(el.hash,"")===window.location.href.replace(location.hash,"")){return"anchor"}if(el.href===window.location.href.split("#")[0]+"#"){return"anchor-empty"}}var isDefaultPrevented=function(event){return event.defaultPrevented||event.returnValue===false};module.exports=function(el){var that=this;el.setAttribute(attrState,"");on(el,"click",function(event){linkAction.call(that,el,event)});on(el,"keyup",function(event){if(event.keyCode===13){linkAction.call(that,el,event)}}.bind(this))}},{"../events/on":4,"../util/clone":20}],13:[function(require,module,exports){var clone=require("../util/clone");var newUid=require("../uniqueid");var trigger=require("../events/trigger");module.exports=function(responseText,request,href,options){options=clone(options||this.options);options.request=request;if(responseText===false){trigger(document,"pjax:complete pjax:error",options);return}var currentState=window.history.state||{};window.history.replaceState({url:currentState.url||window.location.href,title:currentState.title||document.title,uid:currentState.uid||newUid(),scrollPos:[document.documentElement.scrollLeft||document.body.scrollLeft,document.documentElement.scrollTop||document.body.scrollTop]},document.title,window.location.href);var oldHref=href;if(request.responseURL){if(href!==request.responseURL){href=request.responseURL}}else if(request.getResponseHeader("X-PJAX-URL")){href=request.getResponseHeader("X-PJAX-URL")}else if(request.getResponseHeader("X-XHR-Redirected-To")){href=request.getResponseHeader("X-XHR-Redirected-To")}var a=document.createElement("a");a.href=oldHref;var oldHash=a.hash;a.href=href;if(oldHash&&!a.hash){a.hash=oldHash;href=a.href}this.state.href=href;this.state.options=options;try{this.loadContent(responseText,options)}catch(e){trigger(document,"pjax:error",options);if(!this.options.debug){if(console&&console.error){console.error("Pjax switch fail: ",e)}return this.latestChance(href)}else{throw e}}}},{"../events/trigger":5,"../uniqueid":19,"../util/clone":20}],14:[function(require,module,exports){module.exports=function(){if(this.options.debug&&console){if(typeof console.log==="function"){console.log.apply(console,arguments)}else if(console.log){console.log(arguments)}}}},{}],15:[function(require,module,exports){var attrState="data-pjax-state";module.exports=function(el){switch(el.tagName.toLowerCase()){case"a":if(!el.hasAttribute(attrState)){this.attachLink(el)}break;case"form":if(!el.hasAttribute(attrState)){this.attachForm(el)}break;default:throw"Pjax can only be applied on or
    submit"}}},{}],16:[function(require,module,exports){var updateQueryString=require("./util/update-query-string");module.exports=function(location,options,callback){options=options||{};var queryString;var requestOptions=options.requestOptions||{};var requestMethod=(requestOptions.requestMethod||"GET").toUpperCase();var requestParams=requestOptions.requestParams||null;var formData=requestOptions.formData||null;var requestPayload=null;var request=new XMLHttpRequest;var timeout=options.timeout||0;request.onreadystatechange=function(){if(request.readyState===4){if(request.status===200){callback(request.responseText,request,location,options)}else if(request.status!==0){callback(null,request,location,options)}}};request.onerror=function(e){console.log(e);callback(null,request,location,options)};request.ontimeout=function(){callback(null,request,location,options)};if(requestParams&&requestParams.length){queryString=requestParams.map(function(param){return param.name+"="+param.value}).join("&");switch(requestMethod){case"GET":location=location.split("?")[0];location+="?"+queryString;break;case"POST":requestPayload=queryString;break}}else if(formData){requestPayload=formData}if(options.cacheBust){location=updateQueryString(location,"t",Date.now())}request.open(requestMethod,location,true);request.timeout=timeout;request.setRequestHeader("X-Requested-With","XMLHttpRequest");request.setRequestHeader("X-PJAX","true");request.setRequestHeader("X-PJAX-Selectors",JSON.stringify(options.selectors));if(requestPayload&&requestMethod==="POST"&&!formData){request.setRequestHeader("Content-Type","application/x-www-form-urlencoded")}request.send(requestPayload);return request}},{"./util/update-query-string":24}],17:[function(require,module,exports){var forEachEls=require("./foreach-els");var defaultSwitches=require("./switches");module.exports=function(switches,switchesOptions,selectors,fromEl,toEl,options){var switchesQueue=[];selectors.forEach(function(selector){var newEls=fromEl.querySelectorAll(selector);var oldEls=toEl.querySelectorAll(selector);if(this.log){this.log("Pjax switch",selector,newEls,oldEls)}if(newEls.length!==oldEls.length){throw"DOM doesn’t look the same on new loaded page: ’"+selector+"’ - new "+newEls.length+", old "+oldEls.length}forEachEls(newEls,function(newEl,i){var oldEl=oldEls[i];if(this.log){this.log("newEl",newEl,"oldEl",oldEl)}var callback=switches[selector]?switches[selector].bind(this,oldEl,newEl,options,switchesOptions[selector]):defaultSwitches.outerHTML.bind(this,oldEl,newEl,options);switchesQueue.push(callback)},this)},this);this.state.numPendingSwitches=switchesQueue.length;switchesQueue.forEach(function(queuedSwitch){queuedSwitch()})}},{"./foreach-els":7,"./switches":18}],18:[function(require,module,exports){var on=require("./events/on");module.exports={outerHTML:function(oldEl,newEl){oldEl.outerHTML=newEl.outerHTML;this.onSwitch()},innerHTML:function(oldEl,newEl){oldEl.innerHTML=newEl.innerHTML;if(newEl.className===""){oldEl.removeAttribute("class")}else{oldEl.className=newEl.className}this.onSwitch()},switchElementsAlt:function(oldEl,newEl){oldEl.innerHTML=newEl.innerHTML;if(newEl.hasAttributes()){var attrs=newEl.attributes;for(var i=0;i
'};NProgress.configure = function(options) {var key, value;for (key in options) {value = options[key];if (value !== undefined && options.hasOwnProperty(key)) Settings[key] = value;} return this;};NProgress.status = null;NProgress.set = function(n) {var started = NProgress.isStarted();n = clamp(n, Settings.minimum, 1);NProgress.status = (n === 1 ? null : n);var progress = NProgress.render(!started),bar = progress.querySelector(Settings.barSelector),speed = Settings.speed,ease = Settings.easing;progress.offsetWidth;queue(function(next) {if (Settings.positionUsing === '') Settings.positionUsing = NProgress.getPositioningCSS();css(bar, barPositionCSS(n, speed, ease));if (n === 1) {css(progress, {transition: 'none',opacity: 1});progress.offsetWidth;setTimeout(function() {css(progress, {transition: 'all ' + speed + 'ms linear',opacity: 0});setTimeout(function() {NProgress.remove();next();}, speed);}, speed);} else {setTimeout(next, speed);}});return this;};NProgress.isStarted = function() {return typeof NProgress.status === 'number';};NProgress.start = function() {if (!NProgress.status) NProgress.set(0);var work = function() {setTimeout(function() {if (!NProgress.status) return;NProgress.trickle();work();}, Settings.trickleSpeed);};if (Settings.trickle) work();return this;};NProgress.done = function(force) {if (!force && !NProgress.status) return this;return NProgress.inc(0.3 + 0.5 * Math.random()).set(1);};NProgress.inc = function(amount) {var n = NProgress.status;if (!n) {return NProgress.start();} else if(n > 1) {return;} else {if (typeof amount !== 'number') {if (n >= 0 && n < 0.2) { amount = 0.1; } else if (n >= 0.2 && n < 0.5) { amount = 0.04; } else if (n >= 0.5 && n < 0.8) { amount = 0.02; } else if (n >= 0.8 && n < 0.99) { amount = 0.005; } else { amount = 0; }} n = clamp(n + amount, 0, 0.994);return NProgress.set(n);}};NProgress.trickle = function() {return NProgress.inc();};(function() {var initial = 0, current = 0;NProgress.promise = function($promise) {if (!$promise || $promise.state() === "resolved") {return this;} if (current === 0) {NProgress.start();} initial++;current++;$promise.always(function() {current--;if (current === 0) {initial = 0;NProgress.done();} else {NProgress.set((initial - current) / initial);}});return this;};})();NProgress.render = function(fromStart) {if (NProgress.isRendered()) return document.getElementById('nprogress');addClass(document.documentElement, 'nprogress-busy');var progress = document.createElement('div');progress.id = 'nprogress';progress.innerHTML = Settings.template;var bar = progress.querySelector(Settings.barSelector),perc = fromStart ? '-100' : toBarPerc(NProgress.status || 0),parent = document.querySelector(Settings.parent),spinner;css(bar, {transition: 'all 0 linear',transform: 'translate3d(' + perc + '%,0,0)'});if (!Settings.showSpinner) {spinner = progress.querySelector(Settings.spinnerSelector);spinner && removeElement(spinner);} if (parent != document.body) {addClass(parent, 'nprogress-custom-parent');} parent.appendChild(progress);return progress;};NProgress.remove = function() {removeClass(document.documentElement, 'nprogress-busy');removeClass(document.querySelector(Settings.parent), 'nprogress-custom-parent');var progress = document.getElementById('nprogress');progress && removeElement(progress);};NProgress.isRendered = function() {return !!document.getElementById('nprogress');};NProgress.getPositioningCSS = function() {var bodyStyle = document.body.style;var vendorPrefix = ('WebkitTransform' in bodyStyle) ? 'Webkit' :('MozTransform' in bodyStyle) ? 'Moz' :('msTransform' in bodyStyle) ? 'ms' :('OTransform' in bodyStyle) ? 'O' : '';if (vendorPrefix + 'Perspective' in bodyStyle) {return 'translate3d';} else if (vendorPrefix + 'Transform' in bodyStyle) {return 'translate';} else {return 'margin';}};function clamp(n, min, max) {if (n < min) return min;if (n > max) return max;return n;} function toBarPerc(n) {return (-1 + n) * 100;} function barPositionCSS(n, speed, ease) {var barCSS;if (Settings.positionUsing === 'translate3d') {barCSS = { transform: 'translate3d('+toBarPerc(n)+'%,0,0)' };} else if (Settings.positionUsing === 'translate') {barCSS = { transform: 'translate('+toBarPerc(n)+'%,0)' };} else {barCSS = { 'margin-left': toBarPerc(n)+'%' };} barCSS.transition = 'all '+speed+'ms '+ease;return barCSS;} var queue = (function() {var pending = [];function next() {var fn = pending.shift();if (fn) {fn(next);}} return function(fn) {pending.push(fn);if (pending.length == 1) next();};})();var css = (function() {var cssPrefixes = [ 'Webkit', 'O', 'Moz', 'ms' ],cssProps = {};function camelCase(string) {return string.replace(/^-ms-/, 'ms-').replace(/-([\da-z])/gi, function(match, letter) {return letter.toUpperCase();});} function getVendorProp(name) {var style = document.body.style;if (name in style) return name;var i = cssPrefixes.length,capName = name.charAt(0).toUpperCase() + name.slice(1),vendorName;while (i--) {vendorName = cssPrefixes[i] + capName;if (vendorName in style) return vendorName;} return name;} function getStyleProp(name) {name = camelCase(name);return cssProps[name] || (cssProps[name] = getVendorProp(name));} function applyCss(element, prop, value) {prop = getStyleProp(prop);element.style[prop] = value;} return function(element, properties) {var args = arguments,prop,value;if (args.length == 2) {for (prop in properties) {value = properties[prop];if (value !== undefined && properties.hasOwnProperty(prop)) applyCss(element, prop, value);}} else {applyCss(element, args[1], args[2]);}}})();function hasClass(element, name) {var list = typeof element == 'string' ? element : classList(element);return list.indexOf(' ' + name + ' ') >= 0;} function addClass(element, name) {var oldList = classList(element),newList = oldList + name;if (hasClass(oldList, name)) return;element.className = newList.substring(1);} function removeClass(element, name) {var oldList = classList(element),newList;if (!hasClass(element, name)) return;newList = oldList.replace(' ' + name + ' ', ' ');element.className = newList.substring(1, newList.length - 1);} function classList(element) {return (' ' + (element && element.className || '') + ' ').replace(/\s+/gi, ' ');} function removeElement(element) {element && element.parentNode && element.parentNode.removeChild(element);} return NProgress;}); (function (factory) {if (typeof define === 'function' && define.amd) {define(['jquery'], factory);} else if (typeof exports === 'object') {module.exports = factory(require('jquery'));} else {factory(jQuery);}}(function($) {$.detectSwipe = {version: '2.1.2',enabled: 'ontouchstart' in document.documentElement,preventDefault: true,threshold: 20};var startX,startY,isMoving = false;function onTouchEnd() {this.removeEventListener('touchmove', onTouchMove);this.removeEventListener('touchend', onTouchEnd);isMoving = false;} function onTouchMove(e) {if ($.detectSwipe.preventDefault) { e.preventDefault(); } if(isMoving) {var x = e.touches[0].pageX;var y = e.touches[0].pageY;var dx = startX - x;var dy = startY - y;var dir;var ratio = window.devicePixelRatio || 1;if(Math.abs(dx) * ratio >= $.detectSwipe.threshold) {dir = dx > 0 ? 'left' : 'right'} else if(Math.abs(dy) * ratio >= $.detectSwipe.threshold) {dir = dy > 0 ? 'up' : 'down'} if(dir) {onTouchEnd.call(this);$(this).trigger('swipe', dir).trigger('swipe' + dir);}}} function onTouchStart(e) {if (e.touches.length == 1) {startX = e.touches[0].pageX;startY = e.touches[0].pageY;isMoving = true;this.addEventListener('touchmove', onTouchMove, false);this.addEventListener('touchend', onTouchEnd, false);}} function setup() {this.addEventListener && this.addEventListener('touchstart', onTouchStart, false);} function teardown() {this.removeEventListener('touchstart', onTouchStart);} $.event.special.swipe = { setup: setup };$.each(['left', 'up', 'down', 'right'], function () {$.event.special['swipe' + this] = { setup: function(){$(this).on('swipe', $.noop);} };});})); (function (root, factory) {if (typeof define === 'function' && define.amd) {define(["jquery"], function (a0) {return (factory(a0));});} else if (typeof exports === 'object') {module.exports = factory(require("jquery"));} else {factory(jQuery);}}(this, function ($) {var CanvasRenderer = function(el, options) {var cachedBackground;var canvas = document.createElement('canvas');el.appendChild(canvas);if (typeof(G_vmlCanvasManager) === 'object') {G_vmlCanvasManager.initElement(canvas);} var ctx = canvas.getContext('2d');canvas.width = canvas.height = options.size;var scaleBy = 1;if (window.devicePixelRatio > 1) {scaleBy = window.devicePixelRatio;canvas.style.width = canvas.style.height = [options.size, 'px'].join('');canvas.width = canvas.height = options.size * scaleBy;ctx.scale(scaleBy, scaleBy);} ctx.translate(options.size / 2, options.size / 2);ctx.rotate((-1 / 2 + options.rotate / 180) * Math.PI);var radius = (options.size - options.lineWidth) / 2;if (options.scaleColor && options.scaleLength) {radius -= options.scaleLength + 2; // 2 is the distance between scale and bar } Date.now = Date.now || function() {return +(new Date());};var drawCircle = function(color, lineWidth, percent) {percent = Math.min(Math.max(-1, percent || 0), 1);var isNegative = percent <= 0 ? true : false;ctx.beginPath();ctx.arc(0, 0, radius, 0, Math.PI * 2 * percent, isNegative);ctx.strokeStyle = color;ctx.lineWidth = lineWidth;ctx.stroke();};var drawScale = function() {var offset;var length;ctx.lineWidth = 1;ctx.fillStyle = options.scaleColor;ctx.save();for (var i = 24; i > 0; --i) {if (i % 6 === 0) {length = options.scaleLength;offset = 0;} else {length = options.scaleLength * 0.6;offset = options.scaleLength - length;} ctx.fillRect(-options.size/2 + offset, 0, length, 1);ctx.rotate(Math.PI / 12);} ctx.restore();};var reqAnimationFrame = (function() {return window.requestAnimationFrame ||window.webkitRequestAnimationFrame ||window.mozRequestAnimationFrame ||function(callback) {window.setTimeout(callback, 1000 / 60);};}());var drawBackground = function() {if(options.scaleColor) drawScale();if(options.trackColor) drawCircle(options.trackColor, options.trackWidth || options.lineWidth, 1);};this.getCanvas = function() {return canvas;};this.getCtx = function() {return ctx;};this.clear = function() {ctx.clearRect(options.size / -2, options.size / -2, options.size, options.size);};this.draw = function(percent) {if (!!options.scaleColor || !!options.trackColor) {if (ctx.getImageData && ctx.putImageData) {if (!cachedBackground) {drawBackground();cachedBackground = ctx.getImageData(0, 0, options.size * scaleBy, options.size * scaleBy);} else {ctx.putImageData(cachedBackground, 0, 0);}} else {this.clear();drawBackground();}} else {this.clear();} ctx.lineCap = options.lineCap;var color;if (typeof(options.barColor) === 'function') {color = options.barColor(percent);} else {color = options.barColor;} drawCircle(color, options.lineWidth, percent / 100);}.bind(this);this.animate = function(from, to) {var startTime = Date.now();options.onStart(from, to);var animation = function() {var process = Math.min(Date.now() - startTime, options.animate.duration);var currentValue = options.easing(this, process, from, to - from, options.animate.duration);this.draw(currentValue);options.onStep(from, to, currentValue);if (process >= options.animate.duration) {options.onStop(from, to);} else {reqAnimationFrame(animation);}}.bind(this);reqAnimationFrame(animation);}.bind(this);};var EasyPieChart = function(el, opts) {var defaultOptions = {barColor: '#ef1e25',trackColor: '#f9f9f9',scaleColor: '#dfe0e0',scaleLength: 5,lineCap: 'round',lineWidth: 3,trackWidth: undefined,size: 110,rotate: 0,animate: {duration: 1000,enabled: true},easing: function (x, t, b, c, d) { // more can be found here: http://gsgd.co.uk/sandbox/jquery/easing/ t = t / (d/2);if (t < 1) {return c / 2 * t * t + b;} return -c/2 * ((--t)*(t-2) - 1) + b;},onStart: function(from, to) {return;},onStep: function(from, to, currentValue) {return;},onStop: function(from, to) {return;}};if (typeof(CanvasRenderer) !== 'undefined') {defaultOptions.renderer = CanvasRenderer;} else if (typeof(SVGRenderer) !== 'undefined') {defaultOptions.renderer = SVGRenderer;} else {throw new Error('Please load either the SVG- or the CanvasRenderer');} var options = {};var currentValue = 0;var init = function() {this.el = el;this.options = options;for (var i in defaultOptions) {if (defaultOptions.hasOwnProperty(i)) {options[i] = opts && typeof(opts[i]) !== 'undefined' ? opts[i] : defaultOptions[i];if (typeof(options[i]) === 'function') {options[i] = options[i].bind(this);}}} if (typeof(options.easing) === 'string' && typeof(jQuery) !== 'undefined' && jQuery.isFunction(jQuery.easing[options.easing])) {options.easing = jQuery.easing[options.easing];} else {options.easing = defaultOptions.easing;} if (typeof(options.animate) === 'number') {options.animate = {duration: options.animate,enabled: true};} if (typeof(options.animate) === 'boolean' && !options.animate) {options.animate = {duration: 1000,enabled: options.animate};} this.renderer = new options.renderer(el, options);this.renderer.draw(currentValue);if (el.dataset && el.dataset.percent) {this.update(parseFloat(el.dataset.percent));} else if (el.getAttribute && el.getAttribute('data-percent')) {this.update(parseFloat(el.getAttribute('data-percent')));}}.bind(this);this.update = function(newValue) {newValue = parseFloat(newValue);if (options.animate.enabled) {this.renderer.animate(currentValue, newValue);} else {this.renderer.draw(newValue);} currentValue = newValue;return this;}.bind(this);this.disableAnimation = function() {options.animate.enabled = false;return this;};this.enableAnimation = function() {options.animate.enabled = true;return this;};init();};$.fn.easyPieChart = function(options) {return this.each(function() {var instanceOptions;if (!$.data(this, 'easyPieChart')) {instanceOptions = $.extend({}, options, $(this).data());$.data(this, 'easyPieChart', new EasyPieChart(this, instanceOptions));}});};})); var S123_ActionButtons = function() {var that = {settings: {},custom_form_html: {},moduleIDs: {},custom_thank_you_msg: {},customFromInputs: {},};that.init = function() {$('[data-toggle="actionButton_customForm"]').each(function() {$(this).off('click').on('click',function() {var $this = $(this);var uniqueID = $this.data('settings-id');that.moduleIDs[uniqueID] = $this.data('module-id');if ( $('#' + uniqueID).length == 0 ) return;that.settings[uniqueID] = tryParseJSON($('#' + uniqueID).val());that.custom_form_html[uniqueID] = that.settings[uniqueID].custom_form_html ? that.settings[uniqueID].custom_form_html : '';that.custom_thank_you_msg[uniqueID] = that.settings[uniqueID].thankYouMsg ? that.settings[uniqueID].thankYouMsg : '';buildPopup('popupFloatDivActionButtonCustomForm','',that.buildEmailToolForm(uniqueID),'',true,true,true,'right','');S123_ActionButtons.submitHandler(uniqueID);});});};that.buildEmailToolForm = function( uniqueID ) {var html = '';html += '
';that.customFromInputs[uniqueID] = $(that.custom_form_html[uniqueID]).find('.c-f-field-type').length;if ( that.settings[uniqueID].showCustomForm == 'on' && that.custom_form_html[uniqueID].length !== 0 && that.customFromInputs[uniqueID] > 0 ) {html += '';html += that.custom_form_html[uniqueID];html += '';html += '';html += '';html += '';html += '';html += '';html += '
';html += '';} else {html += '
';html += '
';html += '
';html += '
';html += '';html += '';html += '
';html += '
';html += '
';html += '
';html += '';html += '';html += '
';html += '
';html += '
';html += '
';html += '
';html += '
';html += '';html += '';html += '
';html += '
';html += '
';html += '
';html += '
';html += '';html += '
';html += '
';html += '';html += '';html += '';html += '';html += '';html += '';html += '
';html += '
';} html +='';html += '
';return html;};that.submitHandler = function (uniqueID) {var $form = $('.a-b-email-form');var customFormMultiSteps = new CustomFormMultiSteps();customFormMultiSteps.init({$form: $form,$nextButton: $form.find('.next-form-btn'),$submitButton: $form.find('.submit-form-btn'),$previousButton: $form.find('.previous-form-btn'),totalSteps: $form.find('.custom-form-steps').data('total-steps')});$form.find('.f-b-date-timePicker').each( function() {var $option = $(this);var $datePicker = $option.find('.fake-input.date-time-picker');var $hiddenInput = $option.find('[data-id="'+$datePicker.data('related-id')+'"]');var $datePickerIcon = $option.find('.f-b-date-timePicker-icon');var formBuilderCalendar = new calendar_handler();$datePicker.data('date-format',$form.data('date-format'));formBuilderCalendar.init({$fakeInput: $datePicker,$hiddenInput: $hiddenInput,$fakeInputIcon: $datePickerIcon,type: 'datePicker',title: translations.chooseDate,customClass: 'action-button-custom-form',calendarSettings: {format: $datePicker.data('date-format'),weekStart: 0,todayBtn: "linked",clearBtn: false,language: languageCode,todayHighlight: true},onSubmit: function( selectedDate ) {$datePicker.html(selectedDate);$hiddenInput.val(selectedDate);}});});CustomForm_DisableTwoColumns($form);var forms_GoogleRecaptcha = new Forms_GoogleRecaptcha();forms_GoogleRecaptcha.init($form);$form.validate({errorElement: 'div',errorClass: 'help-block',focusInvalid: true,ignore: ':hidden:not(.custom-form-step:visible input[name^="datePicker-"])',highlight: function (e) {$(e).closest('.form-group').removeClass('has-info').addClass('has-error');},success: function (e) {$(e).closest('.form-group').removeClass('has-error');$(e).remove();},submitHandler: function( form ) {var $form = $(form);$form.find('button:submit').prop('disabled', true);if ( forms_GoogleRecaptcha.isActive && !forms_GoogleRecaptcha.isGotToken ) {forms_GoogleRecaptcha.getToken();return false;} var url = '/versions/2/include/contactO.php';if ( that.settings[uniqueID].showCustomForm == 'on' && that.custom_form_html[uniqueID].length !== 0 && that.customFromInputs[uniqueID] > 0 ) {url = '/versions/2/include/customFormO.php';} $.ajax({type: "POST",url: url,data: $form.serialize(),success: function( data ) {data = tryParseJSON(data);$form.trigger("reset");if ( data.conv_code && data.conv_code.length > 0 ) {var $convCode = $('
' + data.conv_code + '
');$form.find('.conv-code-container').html($convCode.text());} if ( data.action.buttonClickAction && data.action.buttonClickAction == 'redirect' ) {if ( data.action.url.length > 0 ) {if ( IsWizard() ) {buildPopup_CloseAction('popupFloatDivActionButtonCustomForm');bootbox.alert({title: translations.previewExternalLinkTitle,message: translations.previewExternalLinkMsg.replace('{{externalLink}}',''+data.action.url+''),className: 'externalAlert'});} else {buildPopup_CloseAction('popupFloatDivActionButtonCustomForm');window.open(data.action.url,'_self');}}} else {$form.addClass("hidden");$(".g-c-email-message-sent-box").show();$(".g-c-email-info-box").hide();$form.next().find(".close-order-thank-you").on("click",function() {buildPopup_CloseAction('popupFloatDivActionButtonCustomForm');});} forms_GoogleRecaptcha.reset();$form.find('button:submit').prop('disabled', false);WizardNotificationUpdate();}});return false;},errorPlacement: function (error, element) {if( element.is('input[type=checkbox]') || element.is('input[type=radio]') ) {var controls = element.closest('div[class*="col-"]');if( controls.find(':checkbox,:radio').length > 0 ) element.closest('.form-group').append(error);else error.insertAfter(element.nextAll('.lbl:eq(0)').eq(0));} else if( element.is('.select2') ) {error.insertAfter(element.siblings('[class*="select2-container"]:eq(0)'));} else if( element.is('.chosen-select') ) {error.insertAfter(element.siblings('[class*="chosen-container"]:eq(0)'));} else {error.appendTo(element.closest('.form-group'));}},});};return that;}();